News aggregator

The point of monads

Haskell on Reddit - Fri, 04/10/2015 - 7:11am

I mean, I know the point of monads. I think I do. They're a powerful tool to help you avoid side effects, think about what you're doing and make it possible for the compiler to do really clever stuff to your code.

I'm trying to do this: I want to write a function that finds out the size of a file. I also want some low-level error handling (because the file may not exist). Wanting to become a true haskeller, I want to not sidestep the monads but bathe in them - absorb them into my essence. Here are my bothers:

The type of my function is

fsize :: Num (Maybe a) => FilePath -> IO (Maybe a)

Because my function evaluates to "Just 10000" if the file was 10000 bytes in size, but "Nothing" if the file wasn't found and the function doesFileExist from System.Directory has the type FilePath -> IO Bool so I want to do all of this inside the IO monad. Fine. But when I want to use the value elswehere I have to now dig it out of not one, but two monads. That brought me to this post where the guy basically just asks "wow do I have to all this heavy lifting with <$> and liftM and fmap just to have error handling and file IO"? The responses are quite illuminating: one guy says "learn the corresponding type class for the monads and refactor the code to use those instead". So... did I spend hours and hours learning about monoids and functors and applicative functors just to find out that there is another layer I have to learn before I can actually use these concepts?

I get what monads are for, and I really appreciate the idea. I do! It's just that at this point we're talking about an energy investment of hours upon hours to learn how to do something that will take a full pagedown of super dense Haskell code that would be like 10 lines of (incredibly unsafe) C. Wasn't the point of Haskell to make it more readable and more elegant? Because it seems like that is the case as long as you're doing pure stuff with folds and really neat compositions but as soon as you want your computer to actually do something that resembles an app or a program it turns into this mess. I mean... I can't be the only one to want error handling and file IO in the same program?

Bit of a rant, yes, but at the heart of it lies an effort to get better at Haskell and actually write usable code. Any replies are appreciated!

submitted by Krexington_III
[link] [28 comments]
Categories: Incoming News

ANN: dtw-1.0

Haskell on Reddit - Fri, 04/10/2015 - 6:26am

I've just release a new version of my dynamic time warping implementation. As this release marks the introduction of automatic testing and deployment (Build Status) via Travis CI, the library is quite stable and feature complete I thought it appropriate to bump the version number to the all famous 1.0.

This has mostly been a lesson in library design, maintenance and deployment for me and I am positively surprised that this has become so easy.

submitted by goliatskipson
[link] [comment]
Categories: Incoming News

Types & Kinds

Haskell on Reddit - Thu, 04/09/2015 - 11:47pm
Categories: Incoming News

ANN: exact-pi 0.1

haskell-cafe - Thu, 04/09/2015 - 8:36pm
I'm announcing the release of the new exact-pi package. It provides a type that exactly represents all rational multiples of integer powers of pi. Because it's closed under multiplication and taking of reciprocals, it's useful for computing exact conversion factors between physical units. In order to provide full Num and Floating instances there is also a representation for approximate values. I'm not sure if this will be of use to anyone else, but it is nice and self-contained so I thought I would put it out there. -Doug McClean _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

Trying to install hmatrix on Windows 7 fails, unknown symbol '_asinh', How to fix?

Haskell on Reddit - Thu, 04/09/2015 - 7:31pm

Hi, trying to install and run hmatrix on Windows 7. It fails with the following error as described here: https://github.com/albertoruiz/hmatrix/issues/91 and no answer has been posted. I've searched and searched and found a few results with similar issues, but no answers. Any help would be much appreciated. Thank you.

submitted by shellraptor
[link] [7 comments]
Categories: Incoming News

Cabal hell

haskell-cafe - Thu, 04/09/2015 - 5:44pm
Since learning Haskell I've had the pleasure of finding my way out of a cabal hell or two. I've developed some knowledge to cope with it [1], but mostly concluded that if I can avoid burdening my projects with dependencies that have many of their own dependencies, then cabal hell can be averted. This puts somewhat of a damper on the joy of haskell's composability. With the new release of GHC I've observed a flurry of discussion on haskell mailing lists and from Linux distro maintainers about all the fixing and patching required to keep the haskell ecosystem going. Meanwhile I've learned other languages and used other tools that don't seem to have this problem that haskell does. For example, in the elm-lang community the package management tool enforces strict api-versioning, and in the clojure ecosystem people talk about "repeatability" and achieve it by using mostly exact-version requirements, even including the language (the language version is a dependency of a project, rather than a constraint of the e
Categories: Offsite Discussion

VACANCIES : 3x PhD position in Fuctional Programming

General haskell list - Thu, 04/09/2015 - 2:45pm
The research group of Software Technology is part of the Software Systems division of in the department of Information and Computer Science at the Utrecht University. We focus our research on functional programming, compiler construction, tools for learning and teaching (serious games, intelligent tutoring systems), program analysis, validation, and verification. Financed by the Technology Foundation STW, the EU, and Utrecht University we currently have job openings for: ** 3x PhD researcher (PhD student) in Functional Programming ** We are looking for PhD students to develop functional programming techniques related to parsing, rewriting, property-based testing, dependently typed programming, or program analysis, and to apply these techniques in several applications, such as distributed systems, applied games, dialogue management systems, or assessment tools. Besides research, the successful candidate will be expected to help supervise MSc students and assist courses. We prefer candidates to start
Categories: Incoming News

VACANCIES : 3x PhD position in Fuctional Programming

haskell-cafe - Thu, 04/09/2015 - 2:45pm
The research group of Software Technology is part of the Software Systems division of in the department of Information and Computer Science at the Utrecht University. We focus our research on functional programming, compiler construction, tools for learning and teaching (serious games, intelligent tutoring systems), program analysis, validation, and verification. Financed by the Technology Foundation STW, the EU, and Utrecht University we currently have job openings for: ** 3x PhD researcher (PhD student) in Functional Programming ** We are looking for PhD students to develop functional programming techniques related to parsing, rewriting, property-based testing, dependently typed programming, or program analysis, and to apply these techniques in several applications, such as distributed systems, applied games, dialogue management systems, or assessment tools. Besides research, the successful candidate will be expected to help supervise MSc students and assist courses. We prefer candidates to start
Categories: Offsite Discussion

acrisciu< at >gmail.com has indicated you're a friend. Accept?

glasgow-user - Thu, 04/09/2015 - 11:51am
Hi, acrisciu< at >gmail.com wants to follow you. ****** Is acrisciu< at >gmail.com you friend? ****** If Yes please follow the link below: http://invites.infoaxe.net/signup_e.html?fullname=&amp;email=glasgow-haskell-users< at >haskell.org&amp;invitername=Adrian+Crisciu&amp;inviterid=18099446&amp;userid=0&amp;token=0&amp;emailmasterid=f539d292-09bf-444a-a7d9-afe59a2f2134&amp;from=acrisciu< at >gmail.com&amp;template=invite_reg_a&src=txt_yes If No please follow the link below: http://invites.infoaxe.net/signup_e.html?fullname=&amp;email=glasgow-haskell-users< at >haskell.org&amp;invitername=Adrian+Crisciu&amp;inviterid=18099446&amp;userid=0&amp;token=0&amp;emailmasterid=f539d292-09bf-444a-a7d9-afe59a2f2134&amp;from=acrisciu< at >gmail.com&amp;template=invite_reg_a&src=txt_no Follow the link below to remove yourself from all such emails http://invites.infoaxe.net/uns_inviter.jsp?email=glasgow-haskell-users< at >haskell.org&amp;iid=f539d292-09bf-444a-a7d9-afe59a2f2134&amp;from=acrisciu< at >gmail.com ____________________________________________
Categories: Offsite Discussion

Final CFP: WPTE 2015 Second International Workshop on Rewriting Techniques for Program Transformations and Evaluation

General haskell list - Thu, 04/09/2015 - 8:23am
FINAL CALL FOR PAPERS Second International Workshop on Rewriting Techniques for Program Transformations and Evaluation WPTE 2015 affiliated with RDP 2015 2 July, 2015, Warsaw, Poland http://www.trs.cm.is.nagoya-u.ac.jp/event/wpte2015/ Aims and Scope ============== The aim of WPTE is to bring together the researchers working on program transformations, evaluation, and operationally-based programming language semantics, using rewriting methods, in order to share the techniques and recent developments and to exchange ideas to encourage further activation of research in this area. The previous WPTE was held in Vienna 2014. Topics of interest in the scope of this workshop include: * Correctness of program transformations, optimizations and translations. * Program transformations for proving termination, confluence and
Categories: Incoming News

PrimMonad for Control.Monad.ST.Lazy?

haskell-cafe - Thu, 04/09/2015 - 3:49am
I notice that the strict ST monad has an instance for PrimMonad but the lazy ST monad does not. Is there a reason why, or is merely an oversight? (What I Am Really Trying To Do: get a purely lazy stream of random values out of mwc-random.) --ken _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

Why are we naming types instead of instances when we have multiple instances per type?

Haskell on Reddit - Thu, 04/09/2015 - 3:19am

Hey this always struck me as odd. Why do we newtype types to use different istances where it would make a lot more sense to name the instance instead? We seem to be naming the wrong thing.

submitted by arianvp
[link] [38 comments]
Categories: Incoming News

Giving up on NixOS (for now)

Haskell on Reddit - Thu, 04/09/2015 - 3:04am
Categories: Incoming News

Generalized Newtype Deriving not allowed in SafeHaskell

haskell-cafe - Thu, 04/09/2015 - 2:43am
When compiling code with Generalized Newtype Deriving and the -fwarn-unsafe flag, I get -XGeneralizedNewtypeDeriving is not allowed in Safe Haskell This happens both in GHC 7.8 and GHC 7.10. I thought I remembered reading somewhere that GNTD is now part of the safe language? The GHC manual used to state that GNTD is not allowed in Safe Haskell: https://downloads.haskell.org/~ghc/7.6.3/docs/html/users_guide/safe-haskell.html#safe-language But this language on GNTD not being part of the safe language was removed in the 7.8 manual: https://downloads.haskell.org/~ghc/7.8.2/docs/html/users_guide/safe-haskell.html#safe-language The GHC release notes don't say anything about this one way or the other. Thoughts? _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

Can you explain this?

Haskell on Reddit - Wed, 04/08/2015 - 8:32pm
  1. Launch ghci

  2. Enter this number https://gist.github.com/eccstartup/382579e0a4ef9133eb16 1312414124532675478362532543571329085712389578957198523598236057236457230478923749028357328974892375829037589230748923569823604327894723589072389547328957238907523895789207589230758932758903274892305692803567892037145892137580927389573289475238956729803659028375892037698023716891205237509812759807589263108972589236589237489326589325790238502156728013523809759823

  3. Enter it^2 for 9 times

I get a Bus error: 10.

I use ghcformacosx, with version 7.10.1 in Yosemite. I notice that not all really large numbers can reproduces this, but this one can cause bus error again and again, even after a restart. I admit that this number is typed randomly if you want to know how I get it. What could be the reason?

submitted by eccstartup
[link] [21 comments]
Categories: Incoming News