News aggregator

Traversable.mapM_ missing

libraries list - Sat, 05/18/2013 - 10:21pm
On some haskell list I read that for lists, mapM_ f l is more space-efficient that just void $ mapM f l Any reason why mapM_ is missing from Data.Traversable? Cheers, Andreas
Categories: Offsite Discussion

Non-deterministic behaviour of aeson's parser

haskell-cafe - Sat, 05/18/2013 - 5:25pm
I am observing a non-deterministic behaviour of aeson's parser. I'm writing here in addition to filing a bug report [1] to draw attention to this (pretty scary) problem. To try to reproduce this problem, do this: git clone https://gist.github.com/5604887.git aeson cd aeson ghc aeson.hs ./aeson | sort | uniq -c This is my result: 32 Left "key \"module\" not present" 55 Left "When parsing the record SymValue of type Main.SymValueInfo the key fixity was not present." 1913 Right () Can others reproduce this in their environments? Does anyone have ideas about where the bug may lie? Many aeson's dependencies do unsafe IO stuff that could lead to such consequences. Roman [1]: https://github.com/bos/aeson/issues/125
Categories: Offsite Discussion

Compiler error in Parsec using ByteString

haskell-cafe - Sat, 05/18/2013 - 12:07pm
Hello all, I am trying to write a small calculator using Parsec. Every thing went fine and I wrote this [1] and now I am trying to use ByteString to make it more faster but getting compiler error which I am not able to figure out. Could some one please tell me what is wrong with this code. In case of indentation error, code on hpaste[2] {-# LANGUAGE OverloadedStrings #-} import qualified Text.Parsec.Token as Token import Text.Parsec.Prim import Text.Parsec.Char import Text.Parsec.Expr import Text.Parsec.Combinator import Text.Parsec.Language import qualified Text.Parsec.ByteString.Lazy as T import qualified Data.ByteString.Lazy.Char8 as BS import Control.Applicative hiding ( ( <|> ) , many ) import Data.Maybe ( fromJust ) languageDef = emptyDef { Token.commentStart = "/*" , Token.commentEnd = "*/" , Token.commentLine = "//" , Token.nestedComments = False , Token.identStart = letter <|> char '_' , Token.identLetter =
Categories: Offsite Discussion

Extensible Records using Implicit Parameters

haskell-cafe - Sat, 05/18/2013 - 9:51am
Hello, Records in Haskell are somewhat of a contentious issue and many proposals have been put forth to address the shortcomings of the current record system [1]. Below, I introduce a small library relying on several GHC extensions, crucially Implicit Parameters and Constraint Kinds, which implements an extensible record system. While by no means production-ready, it is remarkably close to how I think an extensible record system should function. Record access is very convenient (reminiscent of Pascal's with statement), while record update is somewhat cumbersome (but could potentially be improved using Template Haskell). Two caveats: * Type inference for records does not work, so type signatures have to be provided. * When more than one binding for an implicit parameter is in scope, it is not always clear which one takes precedence. However, I think it is safe to assume that if the innermost binding is a let/where binding, it will carry the day. In all other cases, it is probably safest to
Categories: Offsite Discussion

Maybe type

Haskell on Reddit - Sat, 05/18/2013 - 7:43am

Hey all, I have a final in a couple of days, and I'm really struggling with using Maybe as a typeclass. Can someone explain it for me please?

Explain like I'm 5 would of been a good subreddit, but don't know how many functional programmers check there, haha

submitted by matt182
[link] [15 comments]
Categories: Incoming News

GHC STM Notes

del.icio.us/haskell - Fri, 05/17/2013 - 9:16pm
Categories: Offsite Blogs

Call for Participation: HaL8 - Haskell in Leipzig (Germany), June 21

General haskell list - Fri, 05/17/2013 - 3:45pm
Hal8 - Haskell in Leipzig, June 21. visit the workshop web site for program and registration: http://www.bioinf.uni-leipzig.de/conference-registration/13haskell See you - Johannes Waldmann. _______________________________________________ Haskell mailing list Haskell< at >haskell.org http://www.haskell.org/mailman/listinfo/haskell
Categories: Incoming News

question about GADT and deriving automatically aShow instance

haskell-cafe - Fri, 05/17/2013 - 3:32pm
Hi everybody, I have a question about deriving automatically a Show instance when using GADT. It works in this situation: ---------------------------- {-# LANGUAGE GADTs #-} data Male data Female data Person gender where Dead :: Person gender Alive :: { name :: String , weight :: Float , father :: Person gender } -> Person gender deriving Show main = do let a = Alive "Joe" 60 Dead :: Person Male let b = Alive "Jim" 70 a :: Person Male print a print b ---------------------------- Indeed: $ runghc test_show.hs Alive {name = "Joe", weight = 60.0, father = Dead} Alive {name = "Jim", weight = 70.0, father = Alive {name = "Joe", weight = 60.0, father = Dead}} But when I replace "father :: Person gender" by "father :: Person gender2" in the code (this is one of the advantages of GADT: with a classical algebraic data type declaration, gender2 would have to be a type variable for the data type), I obtain: Can't make a derived instance of `Show (Person gender)
Categories: Offsite Discussion

type-level integers for GHC

haskell-cafe - Fri, 05/17/2013 - 7:17am
What is your recommendation for type-level integers? I'd like to use it to improve the unittyped, https://bitbucket.org/xnyhps/haskell-unittyped/ the library for physical dimension. Therefore, I need negative numbers, additions, but multiplications are not necessary. I've been looking forward for the type-nats extension of GHC, but I haven't been able to compile the type-nats branch. Just learned that it still takes a few month to merge the branch into the main. http://hackage.haskell.org/trac/ghc/wiki/Status/May13 Thijs, the original author of unittyped, has commited a branch that uses type-nats, but I can't try that out for the same reason. Best, -- Takayuki MURANUSHI The Hakubi Center for Advanced Research, Kyoto University http://www.hakubi.kyoto-u.ac.jp/02_mem/h22/muranushi.html
Categories: Offsite Discussion

Sudden Clarity Clarence on monads

Haskell on Reddit - Fri, 05/17/2013 - 4:49am
Categories: Incoming News

Lambda expressions (core) to categorical form

haskell-cafe - Fri, 05/17/2013 - 12:50am
I want to convert lambda expressions into a vocabulary of monoidal categories, so that they can be given multiple interpretations, including circuit generation and timing analysis, and hopefully some other far-out alternatives (3D visualization, animated evaluation, etc). More specifically, I want a GHC plugin that makes this transformation on GHC's Core language. If you know of related work, have suggestions, and/or are interested in collaborating/consulting, I'd love to hear. Thanks, - Conal _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

List comprehensions with Word8

haskell-cafe - Thu, 05/16/2013 - 10:15pm
Hello everyone, I was playing with Word8 and list comprehensions and the following examples came up. I have to admit the behavior looks quite strange because it does not seem to be consistent. Can someone shed some light on reason behind some of these outputs? By the way, I have abbreviated some outputs with ellipsis ... [1..10] :: [Word8] [1,2,3,4,5,6,7,8,9,10] [1..100] :: [Word8] [1,2,3,4,5,6,7,8,9,10,...,100] [1..1000] :: [Word8] [1,2,3,4,5,6,7,8,9,10,...,232] [1..10000] :: [Word8] [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16] [1..100000] :: [Word8] [1,2,3,4,5,6,7,8,9,10,...,160] [1..1000000] :: [Word8] [1,2,3,4,5,6,7,8,9,10,...,64] [1..10000000] :: [Word8] [1,2,3,4,5,6,7,8,9,10,...,128] [1..100000000] :: [Word8] [] [1..1000000000] :: [Word8] [] Thank you, Jose
Categories: Offsite Discussion