From n3gb0y at gmail.com Wed Oct 1 06:28:09 2014 From: n3gb0y at gmail.com (Hamid) Date: Wed, 1 Oct 2014 09:58:09 +0330 Subject: [Haskell-beginners] Different behaviors between GHC 7.6.3 and 7.8.3 In-Reply-To: References: Message-ID: Testing on 7.8.2: GHCi, version 7.8.2: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> let x = 3 + 4 Prelude> :print x x = (_t1::Num a => a) Prelude> :force x x = _ Prelude> :print _t1 _t1 = (_t2::Num a => a) Prelude> On Tue, Sep 30, 2014 at 7:03 PM, Emilio De Camargo Francesquini < francesquini at gmail.com> wrote: > Hello everyone, > > I'm quite intrigued about these different behaviors between GHCs 7.6.3 and > 7.8.3: > > > GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help > Loading package ghc-prim ... linking ... done. > Loading package integer-gmp ... linking ... done. > Loading package base ... linking ... done. > Prelude> let x = 3 + 4 > Prelude> :print x > x = (_t1::Integer) > Prelude> :force x > x = 7 > Prelude> print _t1 > 7 > Prelude> > > > GHCi, version 7.8.3: http://www.haskell.org/ghc/ :? for help > Loading package ghc-prim ... linking ... done. > Loading package integer-gmp ... linking ... done. > Loading package base ... linking ... done. > Prelude> let x = 3 + 4 > Prelude> :print x > x = (_t1::Num a => a) > Prelude> :force x > x = _ > Prelude> print _t1 > ghc: panic! (the 'impossible' happened) > (GHC version 7.8.3 for x86_64-unknown-linux): > tcTyVarDetails a{tv atm} [tv] > > Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug > > > Is it really a bug or is it something I really shouldn't be doing? I've > found this (fixed) bug (https://ghc.haskell.org/trac/ghc/ticket/8557), > with a similar error output, but it does not seem to be the same case. > > Thanks > > Emilio > > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -- Cheers, Hamid. -------------- next part -------------- An HTML attachment was scrubbed... URL: From t_gass at gmx.de Wed Oct 1 10:37:36 2014 From: t_gass at gmx.de (Tilmann) Date: Wed, 01 Oct 2014 12:37:36 +0200 Subject: [Haskell-beginners] Connecting telnet connection to a wx widget Message-ID: <542BD970.3010009@gmx.de> Hi, I am stuck at this problem. I want to read from a telnet connection and display the result in a wxHaskell widget (textCtrl). I got the widget and I got the connection piped to stdout, but I don?t know how to connect the two. Any help is greatly appreciated! Versions: conduit 1.2.0.2, wx 0.91.0.0 Thanks a lot, Tilmann This is the code I got so far: module Main where import Control.Concurrent (forkIO, killThread) import Control.Monad.IO.Class (MonadIO, liftIO) import Control.Monad.Trans.Resource import Data.Conduit import Data.Conduit.Binary import Network (connectTo, PortID (..)) import System.IO import Graphics.UI.WX main = start gui gui = do f <- frame [] t <- textCtrl f [] e <- entry f [on click := (onClick t "...")] set f [layout := boxed "console" (grid 5 5 [[floatLeft $ expand $ hstretch $ widget t] ,[expand $ hstretch $ widget e]])] onClick t val pt = set t [ text :~ \x -> val] -- http://www.mega-nerd.com/erikd/Blog/CodeHacking/Haskell/telnet-conduit.html telnet :: String -> Int -> IO () telnet host port = runResourceT $ do (releaseSock, hsock) <- allocate (connectTo host $ PortNumber $ fromIntegral port) hClose (releaseThread, _) <- allocate (forkIO $ runResourceT $ sourceHandle stdin $$ sinkHandle hsock) killThread sourceHandle hsock $$ sinkHandle stdout From hjgtuyl at chello.nl Wed Oct 1 12:02:58 2014 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Wed, 01 Oct 2014 14:02:58 +0200 Subject: [Haskell-beginners] Different behaviors between GHC 7.6.3 and 7.8.3 In-Reply-To: References: Message-ID: On Tue, 30 Sep 2014 17:33:51 +0200, Emilio De Camargo Francesquini wrote: : > GHCi, version 7.8.3: http://www.haskell.org/ghc/ :? for help > Loading package ghc-prim ... linking ... done. > Loading package integer-gmp ... linking ... done. > Loading package base ... linking ... done. > Prelude> let x = 3 + 4 > Prelude> :print x > x = (_t1::Num a => a) > Prelude> :force x > x = _ > Prelude> print _t1 > ghc: panic! (the 'impossible' happened) > (GHC version 7.8.3 for x86_64-unknown-linux): > tcTyVarDetails a{tv atm} [tv] > > Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug > > > Is it really a bug or is it something I really shouldn't be doing? It seems to me that _t1 is a temporary name, therefore it is not meaningful to print _t1; GHCi should give a message telling that _t1 is not defined, not a panic message. It is best to write a bug report for this. Regards, Henk-Jan van Tuyl -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From francesquini at gmail.com Wed Oct 1 12:18:16 2014 From: francesquini at gmail.com (Emilio De Camargo Francesquini) Date: Wed, 1 Oct 2014 09:18:16 -0300 Subject: [Haskell-beginners] Different behaviors between GHC 7.6.3 and 7.8.3 In-Reply-To: References: Message-ID: Hello, That, however, does not explain why Prelude> :force x x = _ did not evaluate "x". I finally found the related bug and apparently it is indeed a known problem: https://ghc.haskell.org/trac/ghc/ticket/9046 Thanks! Emilio 2014-10-01 9:02 GMT-03:00 Henk-Jan van Tuyl : > On Tue, 30 Sep 2014 17:33:51 +0200, Emilio De Camargo Francesquini < > francesquini at gmail.com> wrote: > > : > >> GHCi, version 7.8.3: http://www.haskell.org/ghc/ :? for help >> Loading package ghc-prim ... linking ... done. >> Loading package integer-gmp ... linking ... done. >> Loading package base ... linking ... done. >> Prelude> let x = 3 + 4 >> Prelude> :print x >> x = (_t1::Num a => a) >> Prelude> :force x >> x = _ >> Prelude> print _t1 >> ghc: panic! (the 'impossible' happened) >> (GHC version 7.8.3 for x86_64-unknown-linux): >> tcTyVarDetails a{tv atm} [tv] >> >> Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug >> >> >> Is it really a bug or is it something I really shouldn't be doing? >> > > It seems to me that _t1 is a temporary name, therefore it is not > meaningful to print _t1; GHCi should give a message telling that _t1 is not > defined, not a panic message. It is best to write a bug report for this. > > Regards, > Henk-Jan van Tuyl > > > -- > Folding at home > What if you could share your unused computer power to help find a cure? In > just 5 minutes you can join the world's biggest networked computer and get > us closer sooner. Watch the video. > http://folding.stanford.edu/ > > > http://Van.Tuyl.eu/ > http://members.chello.nl/hjgtuyl/tourdemonad.html > Haskell programming > -- > -------------- next part -------------- An HTML attachment was scrubbed... URL: From shaegis at gmail.com Thu Oct 2 16:40:30 2014 From: shaegis at gmail.com (S. H. Aegis) Date: Fri, 3 Oct 2014 01:40:30 +0900 Subject: [Haskell-beginners] Error message: "Couldn't match expected type" Message-ID: Hello. I'm learning Haskell on OSX. How can I fix this error message? (Code from The Haskell School of Expression, P40) Sorry for border you... Sok. import Graphics.SOE main() = runGraphics ( do w <- openWindow "My First Graphics Program" (300, 300) drawInWindow w (text(100, 200) "HelloFraphicsWorld") spaceClose w ) spaceClose :: Window -> IO() spaceClose w = do k <- getKey w if k == ' ' then closeWindow w else spaceClose w [1 of 1] Compiling Main ( firstGraphics.hs, firstGraphics.o ) firstGraphics.hs:3:1: Couldn't match expected type `IO t0' with actual type `() -> IO ()' In the expression: main When checking the type of the function `main' -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Thu Oct 2 16:49:56 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Thu, 2 Oct 2014 12:49:56 -0400 Subject: [Haskell-beginners] Error message: "Couldn't match expected type" In-Reply-To: References: Message-ID: On Thu, Oct 2, 2014 at 12:40 PM, S. H. Aegis wrote: > main() = You have declared (well, described, but by type inference that's the same thing) main to take a parameter of type "unit" (empty tuple). main doesn't take parameters. Haskell parameters do not work the way most common languages do; using parentheses in function calls the way you would in C/Java/Python etc. will generally get you unexpected type errors, because you're telling it you're passing tuples around. So, the function call f() (f :: () -> a) is different from f (f :: a) and the function call f(a, b) (f :: (a,b) -> c) is different from f a b (f :: a -> b -> c) (The inferred type of `f` is shown after each call.) -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From shaegis at gmail.com Thu Oct 2 16:55:40 2014 From: shaegis at gmail.com (S. H. Aegis) Date: Fri, 3 Oct 2014 01:55:40 +0900 Subject: [Haskell-beginners] Error message: "Couldn't match expected type" In-Reply-To: References: Message-ID: Oh... my... Thank you so much. Maybe, I'm confused with C. Fix main() to main, it works! =) Thank you again, and have a nice day. Sincerely, Sok 2014-10-03 1:49 GMT+09:00 Brandon Allbery : > On Thu, Oct 2, 2014 at 12:40 PM, S. H. Aegis wrote: > >> main() = > > > You have declared (well, described, but by type inference that's the same > thing) main to take a parameter of type "unit" (empty tuple). main doesn't > take parameters. > > Haskell parameters do not work the way most common languages do; using > parentheses in function calls the way you would in C/Java/Python etc. will > generally get you unexpected type errors, because you're telling it you're > passing tuples around. So, the function call > > f() (f :: () -> a) > > is different from > > f (f :: a) > > and the function call > > f(a, b) (f :: (a,b) -> c) > > is different from > > f a b (f :: a -> b -> c) > > (The inferred type of `f` is shown after each call.) > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -- Sok Ha, CHANG Dr. Chang's Clinic. #203. 503-23. AmSa-Dong, GangDong-Gu, Seoul. Tel: +82-2-442-7585 -------------- next part -------------- An HTML attachment was scrubbed... URL: From miroslav.karpis at gmail.com Sat Oct 4 07:07:28 2014 From: miroslav.karpis at gmail.com (Miro Karpis) Date: Sat, 4 Oct 2014 09:07:28 +0200 Subject: [Haskell-beginners] Aeson: parsing json with 'data' field Message-ID: Hi, please can you help me with this.......I have a json file which contains a field with name "data". Problem is that I can not create a data type with "data", (or can I)? How else can I handle this? I know I can convert all json to Object and then search for the field....but I was hoping for some friendly/easier option. json example: { "data" : { "foo" : "bar" } } below definition returns: parse error on input ?data? data Foo = Foo { data :: String } Cheers, Miro -------------- next part -------------- An HTML attachment was scrubbed... URL: From derek.mcloughlin at gmail.com Sat Oct 4 16:40:59 2014 From: derek.mcloughlin at gmail.com (Derek McLoughlin) Date: Sat, 4 Oct 2014 17:40:59 +0100 Subject: [Haskell-beginners] Aeson: parsing json with 'data' field In-Reply-To: References: Message-ID: {-# LANGUAGE OverloadedStrings #-} import Data.Aeson ((.:), (.:?), decode, FromJSON(..), Value(..)) import Control.Applicative ((<$>), (<*>)) import qualified Data.ByteString.Lazy.Char8 as BS data Foo = Foo { _data :: String -- call it anything you like } deriving (Show) instance FromJSON Foo where parseJSON (Object v) = Foo <$> (v .: "data") Testing: ghci> let json = BS.pack "{\"data\":\"hello\"}" ghci> let (Just x) = decode json :: Maybe Foo| ghci> x Foo {_data = "hello"} On 4 October 2014 08:07, Miro Karpis wrote: > Hi, > please can you help me with this.......I have a json file which contains a > field with name "data". Problem is that I can not create a data type with > "data", (or can I)? How else can I handle this? I know I can convert all > json to Object and then search for the field....but I was hoping for some > friendly/easier option. > > > json example: > > { > "data" : { > "foo" : "bar" > } > } > > > below definition returns: parse error on input ?data? > data Foo = Foo { > data :: String > } > > > Cheers, > Miro > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > From miroslav.karpis at gmail.com Sat Oct 4 19:23:46 2014 From: miroslav.karpis at gmail.com (Miro Karpis) Date: Sat, 4 Oct 2014 21:23:46 +0200 Subject: [Haskell-beginners] Aeson: parsing json with 'data' field In-Reply-To: References: Message-ID: thank you, that helped ;-) On Sat, Oct 4, 2014 at 6:40 PM, Derek McLoughlin wrote: > {-# LANGUAGE OverloadedStrings #-} > > import Data.Aeson ((.:), (.:?), decode, FromJSON(..), Value(..)) > import Control.Applicative ((<$>), (<*>)) > import qualified Data.ByteString.Lazy.Char8 as BS > > data Foo = Foo { > _data :: String -- call it anything you like > } > deriving (Show) > > instance FromJSON Foo where > parseJSON (Object v) = > Foo <$> > (v .: "data") > > Testing: > > ghci> let json = BS.pack "{\"data\":\"hello\"}" > ghci> let (Just x) = decode json :: Maybe Foo| > ghci> x > Foo {_data = "hello"} > > > > On 4 October 2014 08:07, Miro Karpis wrote: > > Hi, > > please can you help me with this.......I have a json file which contains > a > > field with name "data". Problem is that I can not create a data type with > > "data", (or can I)? How else can I handle this? I know I can convert all > > json to Object and then search for the field....but I was hoping for some > > friendly/easier option. > > > > > > json example: > > > > { > > "data" : { > > "foo" : "bar" > > } > > } > > > > > > below definition returns: parse error on input ?data? > > data Foo = Foo { > > data :: String > > } > > > > > > Cheers, > > Miro > > > > _______________________________________________ > > Beginners mailing list > > Beginners at haskell.org > > http://www.haskell.org/mailman/listinfo/beginners > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hjgtuyl at chello.nl Sat Oct 4 22:41:44 2014 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Sun, 05 Oct 2014 00:41:44 +0200 Subject: [Haskell-beginners] Connecting telnet connection to a wx widget In-Reply-To: <542BD970.3010009@gmx.de> References: <542BD970.3010009@gmx.de> Message-ID: On Wed, 01 Oct 2014 12:37:36 +0200, Tilmann wrote: > Hi, > > I am stuck at this problem. I want to read from a telnet connection and > display the result in a wxHaskell widget (textCtrl). I got the widget > and I got the connection piped to stdout, but I don?t know how to > connect the two. Any help is greatly appreciated! : : As you haven't got an answer yet, it looks like there is no one with both wxHaskell and Conduit knowledge on this mailing list; I suggest to try the Haskell Caf? mailing list. Regards, Henk-Jan van Tuyl -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From njdupreez at yahoo.com Sat Oct 11 13:02:56 2014 From: njdupreez at yahoo.com (Nicolaas du Preez) Date: Sat, 11 Oct 2014 15:02:56 +0200 Subject: [Haskell-beginners] "Delegating" class instance definition Message-ID: data Cycle = Cycle { name :: String, size :: Double } deriving (Eq, Show) instance Ord Cycle where (<) a b = (<) (size a) (size b) -- problem statement! ? How can I specify that, on the right-hand side of the problem statement, I refer to (<) :: Double -> Double -> Bool instead of (<) :: Cycle -> Cycle -> Bool? Is there another way to state that "Cycle is an instance of Ord based on size"? From allbery.b at gmail.com Sat Oct 11 13:39:48 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Sat, 11 Oct 2014 09:39:48 -0400 Subject: [Haskell-beginners] "Delegating" class instance definition In-Reply-To: References: Message-ID: On Sat, Oct 11, 2014 at 9:02 AM, Nicolaas du Preez wrote: > data Cycle = Cycle { name :: String, size :: Double } deriving (Eq, Show) > > instance Ord Cycle where > (<) a b = (<) (size a) (size b) -- problem statement! > ? > > How can I specify that, on the right-hand side of the problem statement, I > refer to (<) :: Double -> Double -> Bool instead of (<) :: Cycle -> Cycle > -> Bool? > That should be automatic, since it knows that size :: Cycle -> Double and therefore should use the Double instance. Can you provide a minimal full example and full error message? -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From nadirsampaoli at gmail.com Sat Oct 11 14:04:28 2014 From: nadirsampaoli at gmail.com (Nadir Sampaoli) Date: Sat, 11 Oct 2014 16:04:28 +0200 Subject: [Haskell-beginners] "Delegating" class instance definition In-Reply-To: References: Message-ID: "Nicolaas du Preez": > > data Cycle = Cycle { name :: String, size :: Double } deriving (Eq, Show) > > instance Ord Cycle where > (<) a b = (<) (size a) (size b) -- problem statement! > ? > > How can I specify that, on the right-hand side of the problem statement, I refer to (<) :: Double -> Double -> Bool instead of (<) :: Cycle -> Cycle -> Bool? > > Is there another way to state that "Cycle is an instance of Ord based on size"? > There is the `on` function in Data.Function which allows you to express such correlation. On a side note, you probably just want to implement `compare` so all the other functions of the Ord type class can be derived from it. -- Nadir -------------- next part -------------- An HTML attachment was scrubbed... URL: From njdupreez at yahoo.com Sat Oct 11 17:16:36 2014 From: njdupreez at yahoo.com (Nicolaas du Preez) Date: Sat, 11 Oct 2014 19:16:36 +0200 Subject: [Haskell-beginners] "Delegating" class instance definition In-Reply-To: References: Message-ID: <28FD643C-0487-47DB-85A3-60DA9DDC5336@yahoo.com> Thanks for the reply - since you mentioned that it should work I figured there must?ve been a mistake somewhere else. Looking closer I realised that when I copied & pasted the definition for (<) to the rest of the functions and the problem actually occurred at ... max a b = max (size a) (size b) min a b = min (size a) (size b) ? which has return type of Double where it should be Cycle. Regards, Nicolaas On 11 Oct 2014, at 15:39, Brandon Allbery wrote: > On Sat, Oct 11, 2014 at 9:02 AM, Nicolaas du Preez wrote: > data Cycle = Cycle { name :: String, size :: Double } deriving (Eq, Show) > > instance Ord Cycle where > (<) a b = (<) (size a) (size b) -- problem statement! > ? > > How can I specify that, on the right-hand side of the problem statement, I refer to (<) :: Double -> Double -> Bool instead of (<) :: Cycle -> Cycle -> Bool? > > That should be automatic, since it knows that size :: Cycle -> Double and therefore should use the Double instance. Can you provide a minimal full example and full error message? > > -- > brandon s allbery kf8nh sine nomine associates > allbery.b at gmail.com ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners -------------- next part -------------- An HTML attachment was scrubbed... URL: From nadirsampaoli at gmail.com Sat Oct 11 23:03:09 2014 From: nadirsampaoli at gmail.com (Nadir Sampaoli) Date: Sun, 12 Oct 2014 01:03:09 +0200 Subject: [Haskell-beginners] "Delegating" class instance definition In-Reply-To: <28FD643C-0487-47DB-85A3-60DA9DDC5336@yahoo.com> References: <28FD643C-0487-47DB-85A3-60DA9DDC5336@yahoo.com> Message-ID: > Looking closer I realised that when I copied & pasted the definition for (<) to the rest of the functions and the problem actually occurred at > ... > max a b = max (size a) (size b) > min a b = min (size a) (size b) > ? > which has return type of Double where it should be Cycle. To define an Ord instance you only need to implement compare because the other functions are derivable in terms of it. If you wany to explicitly implement max, a correct implementation could be: max a b = if size a < size b then b else a -------------- next part -------------- An HTML attachment was scrubbed... URL: From njdupreez at yahoo.com Sun Oct 12 17:43:50 2014 From: njdupreez at yahoo.com (Nicolaas du Preez) Date: Sun, 12 Oct 2014 19:43:50 +0200 Subject: [Haskell-beginners] "Delegating" class instance definition In-Reply-To: References: <28FD643C-0487-47DB-85A3-60DA9DDC5336@yahoo.com> Message-ID: Thanks for mentioning it; It saves a lot of copy & paste! On 12 Oct 2014, at 01:03, Nadir Sampaoli wrote: > To define an Ord instance you only need to implement compare because the other functions are derivable in terms of it. > If you wany to explicitly implement max, a correct implementation could be: -------------- next part -------------- An HTML attachment was scrubbed... URL: From mmartin4242 at gmail.com Wed Oct 15 17:55:26 2014 From: mmartin4242 at gmail.com (Michael L Martin) Date: Wed, 15 Oct 2014 12:55:26 -0500 Subject: [Haskell-beginners] latest Haskell Platform build fails Message-ID: <543EB50E.3070406@gmail.com> Hello all, I am trying to install the latest version of Haskell Platform and am having a problem. I created a new VM and installed Ubuntu 14.04 server and applied the latest updates. Also installed packages "build-essential" and "zlib1g-dev". I then downloaded and installed ghc-7.8.3 from https://www.haskell.org/ghc/download_ghc_7_8_3#x86_64linux and then downloaded and installed cabal 1.20.0.3 from http://hackage.haskell.org/package/cabal-install. After installing cabal, I did a "cabal update" followed by "cabal install hscolour". Then downloaded the latest Haskell Platform tarball (haskell-platform-2014.2.0.0-srcdist.tar.gz) and attempted to install like this: ./platform.sh ../ghc-7.8.3-x86_64-unknown-linux-deb7.tar.bz2 This fails like this: *** *** Building hptool *** Building hptool-0.1... Preprocessing executable 'hptool' for hptool-0.1... *** *** Running hptool *** # rm (for build/.markers/rel/build/target/usr/local/haskell/ghc-7.8.3-x86_64/lib/happy-1.19.4) # rm (for build/.markers/rel/build/package/happy-1.19.4/build) happy-1.19.4 needs mtl-2.1.3.1 >>> Building happy-1.19.4 # cp (for build/.markers/rel/build/package/happy-1.19.4/build) # rm (for build/.markers/rel/build/package/happy-1.19.4/build) # ghc-pkg (for build/.markers/rel/build/package/happy-1.19.4/build) # ghc-pkg (for build/.markers/rel/build/package/happy-1.19.4/build) Reading package info from "build/package/mtl-2.1.3.1/inplace.conf" ... done. mtl-2.1.3.1: package(s) with this id already exist: mtl-2.1.3.1 Error when running Shake build system: * build-all * build-product * build/product/haskell-platform-2014.2.0.0-unknown-posix-x86_64.tar.gz * build/target * build/.markers/rel/build/target/usr/local/haskell/ghc-7.8.3-x86_64/lib/happy-1.19.4 * build/.markers/rel/build/package/happy-1.19.4/build Development.Shake.command, system command failed Command: /home/mmartin/Downloads/haskell-platform-2014.2.0.0/build/ghc-bindist/local/bin/ghc-pkg register --package-db=build/package/happy-1.19.4/package.conf.d --verbose=1 build/package/mtl-2.1.3.1/inplace.conf Exit code: 1 Stderr: mtl-2.1.3.1: package(s) with this id already exist: mtl-2.1.3.1 Any suggestions on how to get past this? Thanks, Michael Martin From fuuzetsu at fuuzetsu.co.uk Thu Oct 16 20:11:07 2014 From: fuuzetsu at fuuzetsu.co.uk (Mateusz Kowalczyk) Date: Thu, 16 Oct 2014 21:11:07 +0100 Subject: [Haskell-beginners] latest Haskell Platform build fails In-Reply-To: <543EB50E.3070406@gmail.com> References: <543EB50E.3070406@gmail.com> Message-ID: <5440265B.4060308@fuuzetsu.co.uk> On 10/15/2014 06:55 PM, Michael L Martin wrote: > Hello all, > > I am trying to install the latest version of Haskell Platform and am > having a problem. > > I created a new VM and installed Ubuntu 14.04 server and applied the > latest updates. Also installed packages > "build-essential" and "zlib1g-dev". > > I then downloaded and installed ghc-7.8.3 from > https://www.haskell.org/ghc/download_ghc_7_8_3#x86_64linux > and then downloaded and installed cabal 1.20.0.3 from > http://hackage.haskell.org/package/cabal-install. > > After installing cabal, I did a "cabal update" followed by "cabal > install hscolour". > > Then downloaded the latest Haskell Platform tarball > (haskell-platform-2014.2.0.0-srcdist.tar.gz) and attempted to > install like this: > > ./platform.sh ../ghc-7.8.3-x86_64-unknown-linux-deb7.tar.bz2 > > This fails like this: > > *** > *** Building hptool > *** > Building hptool-0.1... > Preprocessing executable 'hptool' for hptool-0.1... > *** > *** Running hptool > *** > # rm (for > build/.markers/rel/build/target/usr/local/haskell/ghc-7.8.3-x86_64/lib/happy-1.19.4) > # rm (for build/.markers/rel/build/package/happy-1.19.4/build) > happy-1.19.4 needs mtl-2.1.3.1 > >>> Building happy-1.19.4 > # cp (for build/.markers/rel/build/package/happy-1.19.4/build) > # rm (for build/.markers/rel/build/package/happy-1.19.4/build) > # ghc-pkg (for build/.markers/rel/build/package/happy-1.19.4/build) > # ghc-pkg (for build/.markers/rel/build/package/happy-1.19.4/build) > Reading package info from "build/package/mtl-2.1.3.1/inplace.conf" ... done. > mtl-2.1.3.1: package(s) with this id already exist: mtl-2.1.3.1 > Error when running Shake build system: > * build-all > * build-product > * build/product/haskell-platform-2014.2.0.0-unknown-posix-x86_64.tar.gz > * build/target > * > build/.markers/rel/build/target/usr/local/haskell/ghc-7.8.3-x86_64/lib/happy-1.19.4 > * build/.markers/rel/build/package/happy-1.19.4/build > Development.Shake.command, system command failed > Command: > /home/mmartin/Downloads/haskell-platform-2014.2.0.0/build/ghc-bindist/local/bin/ghc-pkg > register --package-db=build/package/happy-1.19.4/package.conf.d > --verbose=1 build/package/mtl-2.1.3.1/inplace.conf > Exit code: 1 > Stderr: > mtl-2.1.3.1: package(s) with this id already exist: mtl-2.1.3.1 > > Any suggestions on how to get past this? > > Thanks, > Michael Martin > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > Merely going from the error message and your steps, it seems to me that you're *not* meant to install GHC yourself first and that the platform ships with GHC. I would say try again but without installing GHC and cabal first. -- Mateusz K. From mmartin4242 at gmail.com Thu Oct 16 20:46:15 2014 From: mmartin4242 at gmail.com (Michael L Martin) Date: Thu, 16 Oct 2014 15:46:15 -0500 Subject: [Haskell-beginners] latest Haskell Platform build fails In-Reply-To: <5440265B.4060308@fuuzetsu.co.uk> References: <543EB50E.3070406@gmail.com> <5440265B.4060308@fuuzetsu.co.uk> Message-ID: <54402E97.5060207@gmail.com> On 10/16/2014 03:11 PM, Mateusz Kowalczyk wrote: > On 10/15/2014 06:55 PM, Michael L Martin wrote: >> Hello all, >> >> I am trying to install the latest version of Haskell Platform and am >> having a problem. >> >> I created a new VM and installed Ubuntu 14.04 server and applied the >> latest updates. Also installed packages >> "build-essential" and "zlib1g-dev". >> >> I then downloaded and installed ghc-7.8.3 from >> https://www.haskell.org/ghc/download_ghc_7_8_3#x86_64linux >> and then downloaded and installed cabal 1.20.0.3 from >> http://hackage.haskell.org/package/cabal-install. >> >> After installing cabal, I did a "cabal update" followed by "cabal >> install hscolour". >> >> Then downloaded the latest Haskell Platform tarball >> (haskell-platform-2014.2.0.0-srcdist.tar.gz) and attempted to >> install like this: >> >> ./platform.sh ../ghc-7.8.3-x86_64-unknown-linux-deb7.tar.bz2 >> >> This fails like this: >> >> *** >> *** Building hptool >> *** >> Building hptool-0.1... >> Preprocessing executable 'hptool' for hptool-0.1... >> *** >> *** Running hptool >> *** >> # rm (for >> build/.markers/rel/build/target/usr/local/haskell/ghc-7.8.3-x86_64/lib/happy-1.19.4) >> # rm (for build/.markers/rel/build/package/happy-1.19.4/build) >> happy-1.19.4 needs mtl-2.1.3.1 >> >>> Building happy-1.19.4 >> # cp (for build/.markers/rel/build/package/happy-1.19.4/build) >> # rm (for build/.markers/rel/build/package/happy-1.19.4/build) >> # ghc-pkg (for build/.markers/rel/build/package/happy-1.19.4/build) >> # ghc-pkg (for build/.markers/rel/build/package/happy-1.19.4/build) >> Reading package info from "build/package/mtl-2.1.3.1/inplace.conf" ... done. >> mtl-2.1.3.1: package(s) with this id already exist: mtl-2.1.3.1 >> Error when running Shake build system: >> * build-all >> * build-product >> * build/product/haskell-platform-2014.2.0.0-unknown-posix-x86_64.tar.gz >> * build/target >> * >> build/.markers/rel/build/target/usr/local/haskell/ghc-7.8.3-x86_64/lib/happy-1.19.4 >> * build/.markers/rel/build/package/happy-1.19.4/build >> Development.Shake.command, system command failed >> Command: >> /home/mmartin/Downloads/haskell-platform-2014.2.0.0/build/ghc-bindist/local/bin/ghc-pkg >> register --package-db=build/package/happy-1.19.4/package.conf.d >> --verbose=1 build/package/mtl-2.1.3.1/inplace.conf >> Exit code: 1 >> Stderr: >> mtl-2.1.3.1: package(s) with this id already exist: mtl-2.1.3.1 >> >> Any suggestions on how to get past this? >> >> Thanks, >> Michael Martin >> >> _______________________________________________ >> Beginners mailing list >> Beginners at haskell.org >> http://www.haskell.org/mailman/listinfo/beginners >> > Merely going from the error message and your steps, it seems to me that > you're *not* meant to install GHC yourself first and that the platform > ships with GHC. I would say try again but without installing GHC and > cabal first. > > Well, that didn't work, either: mmartin at cloud:~/Downloads/haskell-platform-2014.2.0.0$ ./platform.sh ../ghc-7.8.3-x86_64-unknown-linux-deb7.tar.bz2 ./platform.sh: 18: ./platform.sh: cabal: not found *** *** Building hptool *** ./platform.sh: 29: ./platform.sh: cabal: not found mmartin at cloud:~/Downloads/haskell-platform-2014.2.0.0$ From defigueiredo at ucdavis.edu Fri Oct 17 03:55:11 2014 From: defigueiredo at ucdavis.edu (Dimitri DeFigueiredo) Date: Thu, 16 Oct 2014 21:55:11 -0600 Subject: [Haskell-beginners] QuickCheck Crazy Message-ID: <5440931F.20203@ucdavis.edu> Hello Everyone, I am trying to do homework #3 of Stephanie Weirich's programming class. It is about QuickCheck. http://www.seas.upenn.edu/~cis552/current/hw/hw03/index.html However, quickCheck is magically coming up with the wrong answer! I am loading a very simple file (distilled from the homework). Here it is: ~~~~ import Test.QuickCheck ------------------------------------------------------------------------------ prop_const :: Eq a => (a -> a -> a) -> a -> a -> Bool prop_const const' a b = const' a b == a const_bug :: a -> b -> b const_bug _ b = b -- Oops: this returns the *second* argument, not the first. --main = quickCheck (prop_const const) ~~~~ Now, I just wanted to check that 'prop_const' holds for the 'const' function, but fails for 'const_bug' So, I fired up GHCi, but here's what happens: econ1gw-131-21-dhcp:week3 dimitri$ ghci GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> :l weird-quickcheck.hs [1 of 1] Compiling Main ( weird-quickcheck.hs, interpreted ) weird-quickcheck.hs:22:1: Warning: The import of `Test.QuickCheck' is redundant except perhaps to import instances from `Test.QuickCheck' To import instances alone, use: import Test.QuickCheck() Ok, modules loaded: Main. *Main> const 1 2 1 *Main> const_bug 1 2 Loading package array-0.4.0.1 ... linking ... done. Loading package deepseq-1.3.0.1 ... linking ... done. Loading package old-locale-1.0.0.5 ... linking ... done. Loading package time-1.4.0.1 ... linking ... done. Loading package random-1.0.1.1 ... linking ... done. Loading package primitive-0.5.0.1 ... linking ... done. Loading package pretty-1.1.1.0 ... linking ... done. Loading package containers-0.5.0.0 ... linking ... done. Loading package template-haskell ... linking ... done. Loading package tf-random-0.5 ... linking ... done. Loading package transformers-0.3.0.0 ... linking ... done. Loading package QuickCheck-2.7.6 ... linking ... done. 2 *Main> :t prop_const prop_const :: Eq a => (a -> a -> a) -> a -> a -> Bool *Main> quickCheck (prop_const const) +++ OK, passed 100 tests. *Main> quickCheck (prop_const const_bug) +++ OK, passed 100 tests. *Main> quickCheck (prop_const const_bug :: Char -> Char -> Bool) *** Failed! Falsifiable (after 1 test and 2 shrinks): 'a' 'b' *Main> This makes no sense to me! First, I have no idea how quickCheck is able to run any tests at all as the type of 'const' is: *Main> :t const const :: a -> b -> a In other words, it's a polymorphic type. Second, why does GHCi load so many files when I try to evaluate 'const_bug'? Finally and most puzzling, why does quickCheck give out the wrong result if I don't specify the type when testing 'const_bug'? That's really scary. It means that quickCheck can easily fool me if I forget to specify the necessary types. (GHC complains if I uncommented the '--main' line, so I can only do this in GHCi.) I am totally lost here, any pointers would be much appreciated. Thanks, Dimitri From ky3 at atamo.com Fri Oct 17 04:34:16 2014 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Fri, 17 Oct 2014 11:34:16 +0700 Subject: [Haskell-beginners] QuickCheck Crazy In-Reply-To: <5440931F.20203@ucdavis.edu> References: <5440931F.20203@ucdavis.edu> Message-ID: On Fri, Oct 17, 2014 at 10:55 AM, Dimitri DeFigueiredo < defigueiredo at ucdavis.edu> wrote: > Finally and most puzzling, why does quickCheck give out the wrong result > if I don't specify the type when testing 'const_bug'? Quickcheck properties must be monomorphic. Otherwise defaulting rules set you up for () and hilarity ensues. Did you google "quickcheck polymorphic types"? -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From defigueiredo at ucdavis.edu Fri Oct 17 05:53:49 2014 From: defigueiredo at ucdavis.edu (Dimitri DeFigueiredo) Date: Thu, 16 Oct 2014 23:53:49 -0600 Subject: [Haskell-beginners] QuickCheck Crazy In-Reply-To: References: <5440931F.20203@ucdavis.edu> Message-ID: <5440AEED.5090407@ucdavis.edu> Thanks Kim-Ee! This makes more sense now. It does still seem like very unsafe default behavior by quickCheck. In other words, quickcheck shouldn't be designed to let code pass all tests if its user (me) forgets to make a property monomorphic. In any case, the following two links suggested by your google search were very useful: http://www.haskell.org/pipermail/haskell/2009-October/021657.html and the related paper http://www.cse.chalmers.se/~bernardy/PolyTest.pdf Thanks again, Dimitri On 16/10/14 22:34, Kim-Ee Yeoh wrote: > > On Fri, Oct 17, 2014 at 10:55 AM, Dimitri DeFigueiredo > > wrote: > > Finally and most puzzling, why does quickCheck give out the wrong > result if I don't specify the type when testing 'const_bug'? > > > Quickcheck properties must be monomorphic. Otherwise defaulting rules > set you up for () and hilarity ensues. > > Did you google "quickcheck polymorphic types"? > > -- Kim-Ee > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Fri Oct 17 13:59:54 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Fri, 17 Oct 2014 09:59:54 -0400 Subject: [Haskell-beginners] QuickCheck Crazy In-Reply-To: <5440AEED.5090407@ucdavis.edu> References: <5440931F.20203@ucdavis.edu> <5440AEED.5090407@ucdavis.edu> Message-ID: On Fri, Oct 17, 2014 at 1:53 AM, Dimitri DeFigueiredo < defigueiredo at ucdavis.edu> wrote: > This makes more sense now. It does still seem like very unsafe default > behavior by quickCheck. QuickCheck has no way of knowing that ghci has ExtendedDefaultRules enabled, and (quite aside from the difficulty of doing type-case in Haskell) I'm not sure that arbitrarily declaring types involving () to be user error is a good idea. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From defigueiredo at ucdavis.edu Fri Oct 17 18:55:20 2014 From: defigueiredo at ucdavis.edu (Dimitri DeFigueiredo) Date: Fri, 17 Oct 2014 12:55:20 -0600 Subject: [Haskell-beginners] QuickCheck Crazy In-Reply-To: References: <5440931F.20203@ucdavis.edu> <5440AEED.5090407@ucdavis.edu> Message-ID: <54416618.8000102@ucdavis.edu> I agree we have to pick a poison here and I didn't know that the Extended Default Rules were the culprit, but I think the end result is scary because forgetting a type signature is about the most common mistake I make. Having that imply that tests will silently pass means (to me) that it's not safe to use Quickcheck with GHCi. Or, just remember to always make properties monomorphic. "Always!" I would be much more comfortable using quickCheck' the version where () implies user error, as you suggested. For me that is an enhacement to quickCheck that allows it to be used in GHCi, but that is just my opinion. In any case, thanks for shedding more light on the reasons behind the design. Dimitri On 17/10/14 07:59, Brandon Allbery wrote: > On Fri, Oct 17, 2014 at 1:53 AM, Dimitri DeFigueiredo > > wrote: > > This makes more sense now. It does still seem like very unsafe > default behavior by quickCheck. > > > QuickCheck has no way of knowing that ghci has ExtendedDefaultRules > enabled, and (quite aside from the difficulty of doing type-case in > Haskell) I'm not sure that arbitrarily declaring types involving () to > be user error is a good idea. > > -- > brandon s allbery kf8nh sine nomine associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Fri Oct 17 19:16:57 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Fri, 17 Oct 2014 15:16:57 -0400 Subject: [Haskell-beginners] QuickCheck Crazy In-Reply-To: <54416618.8000102@ucdavis.edu> References: <5440931F.20203@ucdavis.edu> <5440AEED.5090407@ucdavis.edu> <54416618.8000102@ucdavis.edu> Message-ID: On Fri, Oct 17, 2014 at 2:55 PM, Dimitri DeFigueiredo < defigueiredo at ucdavis.edu> wrote: > I agree we have to pick a poison here and I didn't know that the Extended > Default Rules were the culprit, but I think the end result is scary because > forgetting a type signature is about the most common mistake I make. Having > that imply that tests will silently pass means (to me) that it's not safe > to use Quickcheck with GHCi. Or, just remember to always make properties > monomorphic. "Always!" > It might make more sense to have a warning in the QuickCheck documentation that, from ghci, it's best to ":seti -XNoExtendedDefaultRules" (and/or add that to .ghci / ghci.ini) to avoid surprises. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From defigueiredo at ucdavis.edu Fri Oct 17 20:05:38 2014 From: defigueiredo at ucdavis.edu (Dimitri DeFigueiredo) Date: Fri, 17 Oct 2014 14:05:38 -0600 Subject: [Haskell-beginners] QuickCheck Crazy In-Reply-To: References: <5440931F.20203@ucdavis.edu> <5440AEED.5090407@ucdavis.edu> <54416618.8000102@ucdavis.edu> Message-ID: <54417692.7090807@ucdavis.edu> That is a great idea! I'm changing my ghci configuration as I write this. Problem solved! Thanks, Dimitri On 17/10/14 13:16, Brandon Allbery wrote: > On Fri, Oct 17, 2014 at 2:55 PM, Dimitri DeFigueiredo > > wrote: > > I agree we have to pick a poison here and I didn't know that the > Extended Default Rules were the culprit, but I think the end > result is scary because forgetting a type signature is about the > most common mistake I make. Having that imply that tests will > silently pass means (to me) that it's not safe to use Quickcheck > with GHCi. Or, just remember to always make properties > monomorphic. "Always!" > > > It might make more sense to have a warning in the QuickCheck > documentation that, from ghci, it's best to ":seti > -XNoExtendedDefaultRules" (and/or add that to .ghci / ghci.ini) to > avoid surprises. > > -- > brandon s allbery kf8nh sine nomine associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners -------------- next part -------------- An HTML attachment was scrubbed... URL: From apfelmus at quantentunnel.de Sat Oct 18 07:31:44 2014 From: apfelmus at quantentunnel.de (Heinrich Apfelmus) Date: Sat, 18 Oct 2014 09:31:44 +0200 Subject: [Haskell-beginners] latest Haskell Platform build fails In-Reply-To: <54402E97.5060207@gmail.com> References: <543EB50E.3070406@gmail.com> <5440265B.4060308@fuuzetsu.co.uk> <54402E97.5060207@gmail.com> Message-ID: Michael L Martin wrote: > On 10/16/2014 03:11 PM, Mateusz Kowalczyk wrote: >> Merely going from the error message and your steps, it seems to me that >> you're *not* meant to install GHC yourself first and that the platform >> ships with GHC. I would say try again but without installing GHC and >> cabal first. >> >> > Well, that didn't work, either: > > mmartin at cloud:~/Downloads/haskell-platform-2014.2.0.0$ ./platform.sh > .../ghc-7.8.3-x86_64-unknown-linux-deb7.tar.bz2 > ../platform.sh: 18: ./platform.sh: cabal: not found > *** > *** Building hptool > *** > ../platform.sh: 29: ./platform.sh: cabal: not found > mmartin at cloud:~/Downloads/haskell-platform-2014.2.0.0$ Apparently, different distributions of the Haskell Platform differ in what tools they package: the binary distribution includes GHC and cabal, whereas the source distribution, which you are currently trying to install, doesn't include GHC and cabal. Judging from the error message > Stderr: > mtl-2.1.3.1: package(s) with this id already exist: mtl-2.1.3.1 it seems that the platform tries to build the `mtl` package, but fails because it is already installed. You can use the command $ ghc-pkg list to see which packages are installed globally and in your home directory. Most likely, `mtl` got installed because you installed `cabal-install`. I have no idea how to deal with the conflict, though, I'm not really familiar with the Haskell platform source distribution. Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com From johannes.engels at hft-stuttgart.de Sat Oct 18 10:02:36 2014 From: johannes.engels at hft-stuttgart.de (Johannes Joachim Engels) Date: Sat, 18 Oct 2014 10:02:36 +0000 Subject: [Haskell-beginners] How to override a type class instance ? Message-ID: <4D9B1CA5E471E143A1AC4EB5C3DD5BCA21327B@exdb02.ad.hft-stuttgart.de> An HTML attachment was scrubbed... URL: From nadirsampaoli at gmail.com Sat Oct 18 12:00:00 2014 From: nadirsampaoli at gmail.com (Nadir Sampaoli) Date: Sat, 18 Oct 2014 14:00:00 +0200 Subject: [Haskell-beginners] How to override a type class instance ? In-Reply-To: <4D9B1CA5E471E143A1AC4EB5C3DD5BCA21327B@exdb02.ad.hft-stuttgart.de> References: <4D9B1CA5E471E143A1AC4EB5C3DD5BCA21327B@exdb02.ad.hft-stuttgart.de> Message-ID: Hi, > say, I am not happy with the Show instances of arrays, e.g. You usually wrap the data type in a newtype and use GeneralizedNewtypeDeriving to derive the classes you want to keep. Then write custom instances for the type classes you want to override. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mmartin4242 at gmail.com Sat Oct 18 12:16:21 2014 From: mmartin4242 at gmail.com (Michael Martin) Date: Sat, 18 Oct 2014 07:16:21 -0500 Subject: [Haskell-beginners] latest Haskell Platform build fails In-Reply-To: References: <543EB50E.3070406@gmail.com> <5440265B.4060308@fuuzetsu.co.uk> <54402E97.5060207@gmail.com> Message-ID: <54425A15.7090400@gmail.com> On 10/18/2014 02:31 AM, Heinrich Apfelmus wrote: > Michael L Martin wrote: >> On 10/16/2014 03:11 PM, Mateusz Kowalczyk wrote: >>> Merely going from the error message and your steps, it seems to me that >>> you're *not* meant to install GHC yourself first and that the platform >>> ships with GHC. I would say try again but without installing GHC and >>> cabal first. >>> >>> >> Well, that didn't work, either: >> >> mmartin at cloud:~/Downloads/haskell-platform-2014.2.0.0$ ./platform.sh >> .../ghc-7.8.3-x86_64-unknown-linux-deb7.tar.bz2 >> ../platform.sh: 18: ./platform.sh: cabal: not found >> *** >> *** Building hptool >> *** >> ../platform.sh: 29: ./platform.sh: cabal: not found >> mmartin at cloud:~/Downloads/haskell-platform-2014.2.0.0$ > > Apparently, different distributions of the Haskell Platform differ in > what tools they package: the binary distribution includes GHC and > cabal, whereas the source distribution, which you are currently trying > to install, doesn't include GHC and cabal. > > Judging from the error message > > > Stderr: > > mtl-2.1.3.1: package(s) with this id already exist: mtl-2.1.3.1 > > it seems that the platform tries to build the `mtl` package, but fails > because it is already installed. You can use the command > > $ ghc-pkg list > > to see which packages are installed globally and in your home > directory. Most likely, `mtl` got installed because you installed > `cabal-install`. I have no idea how to deal with the conflict, though, > I'm not really familiar with the Haskell platform source distribution. > > > Best regards, > Heinrich Apfelmus > > -- > http://apfelmus.nfshost.com > Thanks, Heinrich. I find it astonishing that build/install fails because it finds that a dependency that it needs is already installed. This is totally unreasonable. I was really looking forward to experimenting with Cloud Haskell, but the pain of installation, coupled with Haskell's well-known issues with "dependency hell", have soured me on Haskell. The language itself is amazing - I really like it. But I'm afraid that the dysfunctional nature of the Haskell ecosystem is driving me back to Erlang/OTP. OTP has proven to be industrial strength. I hope that someday (soon), Haskell will be able to claim that, as well. > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners From fuuzetsu at fuuzetsu.co.uk Sat Oct 18 12:40:45 2014 From: fuuzetsu at fuuzetsu.co.uk (Mateusz Kowalczyk) Date: Sat, 18 Oct 2014 13:40:45 +0100 Subject: [Haskell-beginners] latest Haskell Platform build fails In-Reply-To: <54425A15.7090400@gmail.com> References: <543EB50E.3070406@gmail.com> <5440265B.4060308@fuuzetsu.co.uk> <54402E97.5060207@gmail.com> <54425A15.7090400@gmail.com> Message-ID: <54425FCD.50104@fuuzetsu.co.uk> On 10/18/2014 01:16 PM, Michael Martin wrote: > > On 10/18/2014 02:31 AM, Heinrich Apfelmus wrote: >> Michael L Martin wrote: >>> On 10/16/2014 03:11 PM, Mateusz Kowalczyk wrote: >>>> Merely going from the error message and your steps, it seems to me that >>>> you're *not* meant to install GHC yourself first and that the platform >>>> ships with GHC. I would say try again but without installing GHC and >>>> cabal first. >>>> >>>> >>> Well, that didn't work, either: >>> >>> mmartin at cloud:~/Downloads/haskell-platform-2014.2.0.0$ ./platform.sh >>> .../ghc-7.8.3-x86_64-unknown-linux-deb7.tar.bz2 >>> ../platform.sh: 18: ./platform.sh: cabal: not found >>> *** >>> *** Building hptool >>> *** >>> ../platform.sh: 29: ./platform.sh: cabal: not found >>> mmartin at cloud:~/Downloads/haskell-platform-2014.2.0.0$ >> >> Apparently, different distributions of the Haskell Platform differ in >> what tools they package: the binary distribution includes GHC and >> cabal, whereas the source distribution, which you are currently trying >> to install, doesn't include GHC and cabal. >> >> Judging from the error message >> >>> Stderr: >>> mtl-2.1.3.1: package(s) with this id already exist: mtl-2.1.3.1 >> >> it seems that the platform tries to build the `mtl` package, but fails >> because it is already installed. You can use the command >> >> $ ghc-pkg list >> >> to see which packages are installed globally and in your home >> directory. Most likely, `mtl` got installed because you installed >> `cabal-install`. I have no idea how to deal with the conflict, though, >> I'm not really familiar with the Haskell platform source distribution. >> >> >> Best regards, >> Heinrich Apfelmus >> >> -- >> http://apfelmus.nfshost.com >> > Thanks, Heinrich. > > I find it astonishing that build/install fails because it finds that a > dependency that it needs is already > installed. This is totally unreasonable. I was really looking forward to > experimenting with Cloud Haskell, > but the pain of installation, coupled with Haskell's well-known issues > with "dependency hell", have > soured me on Haskell. The language itself is amazing - I really like it. > But I'm afraid that the dysfunctional > nature of the Haskell ecosystem is driving me back to Erlang/OTP. OTP > has proven to be industrial > strength. I hope that someday (soon), Haskell will be able to claim > that, as well. > Why don't you use [1] instead of getting the source binary and finding yourself struggling? It comes with GHC. [1]: http://www.haskell.org/platform/linux.html#binary -- Mateusz K. From johannes.engels at hft-stuttgart.de Sat Oct 18 15:06:46 2014 From: johannes.engels at hft-stuttgart.de (Johannes Joachim Engels) Date: Sat, 18 Oct 2014 15:06:46 +0000 Subject: [Haskell-beginners] How to override a type class instance ? Message-ID: <4D9B1CA5E471E143A1AC4EB5C3DD5BCA2132A9@exdb02.ad.hft-stuttgart.de> > You usually wrap the data type in a newtype and use > GeneralizedNewtypeDeriving to derive the classes you want to keep. Then > write custom instances for the type classes you want to override. thank you very much, this worked! Best regards Johannes From kallarhynn at gmail.com Sat Oct 18 15:08:16 2014 From: kallarhynn at gmail.com (Keeley Abbott) Date: Sat, 18 Oct 2014 08:08:16 -0700 Subject: [Haskell-beginners] Trouble Understanding How to Start Message-ID: <0A37A212-BDAA-4EC2-B359-BED9E616A74B@gmail.com> Hi All, So, I am taking a Functional Programming class this fall, and I have struggling to understand how to build types and functions correctly. For some reason it just isn?t clicking. I have the following module I am working on, and I need some guidance. ? Variable names type Name = String ? An environment for looking up the value of a variable type Env = Name -> Maybe Int ? An empty environment empty :: Env empty env = Nothing ? Set a variable to a value in the environment if it doesn?t already exist set :: Name -> Int -> Env -> Env set x i e = \y -> if x == y then (Just i) else e y ? Lookup the value of a variable in the environment get :: Name -> Env -> Int get x env = ?? (I previously had ?type Env = Name -> Int?, so this was working with env x, but we had to change empty to be something other than just a runtime error, which is why I made Env = Name -> Maybe Int) ?Remove a variable from the environment unset :: Name -> Env -> Env unset x e = \y -> if x == y then empty x else env y At this point I don?t know how to fix get, so I get an int to display (it keeps telling me it can?t match the type ?Maybe Int? with the expected type ?Int?). And I don?t know where to go from there to create getOr, setAll, and mapEnv functions, because I am just not understanding what I am doing. For the most part I have been doing simpler things that I could just mess with the functions until they work, but even at that I?m not getting HOW they work? Any assistance or instruction on how I can GET what I am trying to do would be greatly appreciated. Thanks, Kallarhynn From bob at redivi.com Sat Oct 18 16:26:18 2014 From: bob at redivi.com (Bob Ippolito) Date: Sat, 18 Oct 2014 09:26:18 -0700 Subject: [Haskell-beginners] Trouble Understanding How to Start In-Reply-To: <0A37A212-BDAA-4EC2-B359-BED9E616A74B@gmail.com> References: <0A37A212-BDAA-4EC2-B359-BED9E616A74B@gmail.com> Message-ID: What is `get` supposed to do when there is no variable equal to `x`? The type should be `Name -> Env -> Maybe Int`, there should be some additional argument for the default value, or there should be some hard-coded default value. If you were using a hard-coded default value of `-1` it might look like this: get :: Name -> Env -> Int get x env = case env x of Just n -> n Nothing -> -1 On Sat, Oct 18, 2014 at 8:08 AM, Keeley Abbott wrote: > Hi All, > > So, I am taking a Functional Programming class this fall, and I have > struggling to understand how to build types and functions correctly. For > some reason it just isn?t clicking. I have the following module I am > working on, and I need some guidance. > > ? Variable names > type Name = String > > ? An environment for looking up the value of a variable > type Env = Name -> Maybe Int > > ? An empty environment > empty :: Env > empty env = Nothing > > ? Set a variable to a value in the environment if it doesn?t already exist > set :: Name -> Int -> Env -> Env > set x i e = \y -> if x == y then (Just i) else e y > > ? Lookup the value of a variable in the environment > get :: Name -> Env -> Int > get x env = ?? (I previously had ?type Env = Name -> Int?, so this was > working with env x, but we had to change empty to be something other than > just a runtime error, which is why I made Env = Name -> Maybe Int) > > ?Remove a variable from the environment > unset :: Name -> Env -> Env > unset x e = \y -> if x == y then empty x else env y > > At this point I don?t know how to fix get, so I get an int to display (it > keeps telling me it can?t match the type ?Maybe Int? with the expected type > ?Int?). And I don?t know where to go from there to create getOr, setAll, > and mapEnv functions, because I am just not understanding what I am doing. > For the most part I have been doing simpler things that I could just mess > with the functions until they work, but even at that I?m not getting HOW > they work? Any assistance or instruction on how I can GET what I am trying > to do would be greatly appreciated. > > Thanks, > Kallarhynn > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From objitsu at gmail.com Sat Oct 18 19:09:53 2014 From: objitsu at gmail.com (emacstheviking) Date: Sat, 18 Oct 2014 20:09:53 +0100 Subject: [Haskell-beginners] latest Haskell Platform build fails In-Reply-To: <54425A15.7090400@gmail.com> References: <543EB50E.3070406@gmail.com> <5440265B.4060308@fuuzetsu.co.uk> <54402E97.5060207@gmail.com> <54425A15.7090400@gmail.com> Message-ID: Lurker speaks: I too came to the same conclusion as Michael a long time back; I absolutely love Haskell but sooner or later it seemed to me that the "dependancy hell" would kick in just when you least needed / expected it to. It is the single biggest put off for me now to consider using it. I too find myself back in Erlang and Prolog these days, and I have begun learning OCaml instead as it offers a lot of things that Haskell seems but without the pure functional venus flytraps of monads, state transformers etc etc. Not all jobbing developers are math majors or CS majors, some of us are just mere mortals wishing to use shinier tools for a safer and more rigorous path to freedom from day job hell! But, SPJ et al.... f* awesome language! :) Sean On 18 October 2014 13:16, Michael Martin wrote: > > On 10/18/2014 02:31 AM, Heinrich Apfelmus wrote: > >> Michael L Martin wrote: >> >>> On 10/16/2014 03:11 PM, Mateusz Kowalczyk wrote: >>> >>>> Merely going from the error message and your steps, it seems to me that >>>> you're *not* meant to install GHC yourself first and that the platform >>>> ships with GHC. I would say try again but without installing GHC and >>>> cabal first. >>>> >>>> >>>> Well, that didn't work, either: >>> >>> mmartin at cloud:~/Downloads/haskell-platform-2014.2.0.0$ ./platform.sh >>> .../ghc-7.8.3-x86_64-unknown-linux-deb7.tar.bz2 >>> ../platform.sh: 18: ./platform.sh: cabal: not found >>> *** >>> *** Building hptool >>> *** >>> ../platform.sh: 29: ./platform.sh: cabal: not found >>> mmartin at cloud:~/Downloads/haskell-platform-2014.2.0.0$ >>> >> >> Apparently, different distributions of the Haskell Platform differ in >> what tools they package: the binary distribution includes GHC and cabal, >> whereas the source distribution, which you are currently trying to install, >> doesn't include GHC and cabal. >> >> Judging from the error message >> >> > Stderr: >> > mtl-2.1.3.1: package(s) with this id already exist: mtl-2.1.3.1 >> >> it seems that the platform tries to build the `mtl` package, but fails >> because it is already installed. You can use the command >> >> $ ghc-pkg list >> >> to see which packages are installed globally and in your home directory. >> Most likely, `mtl` got installed because you installed `cabal-install`. I >> have no idea how to deal with the conflict, though, I'm not really familiar >> with the Haskell platform source distribution. >> >> >> Best regards, >> Heinrich Apfelmus >> >> -- >> http://apfelmus.nfshost.com >> >> Thanks, Heinrich. > > I find it astonishing that build/install fails because it finds that a > dependency that it needs is already > installed. This is totally unreasonable. I was really looking forward to > experimenting with Cloud Haskell, > but the pain of installation, coupled with Haskell's well-known issues > with "dependency hell", have > soured me on Haskell. The language itself is amazing - I really like it. > But I'm afraid that the dysfunctional > nature of the Haskell ecosystem is driving me back to Erlang/OTP. OTP has > proven to be industrial > strength. I hope that someday (soon), Haskell will be able to claim that, > as well. > > > > _______________________________________________ >> Beginners mailing list >> Beginners at haskell.org >> http://www.haskell.org/mailman/listinfo/beginners >> > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From toad3k at gmail.com Sat Oct 18 19:32:47 2014 From: toad3k at gmail.com (David McBride) Date: Sat, 18 Oct 2014 15:32:47 -0400 Subject: [Haskell-beginners] Trouble Understanding How to Start In-Reply-To: <0A37A212-BDAA-4EC2-B359-BED9E616A74B@gmail.com> References: <0A37A212-BDAA-4EC2-B359-BED9E616A74B@gmail.com> Message-ID: It might help you to remember that you can sort of replace the types in a function with their equivalents, and it may lead you to realizing how to do them. For example: get :: Name -> Env -> Int is equivalent to get :: String -> (String -> Maybe Int) -> Int So think about how you can take the string you have, put it into that function that takes a string and gives a maybe int, then how to get the int out of the maybe int. You'll get it. On Sat, Oct 18, 2014 at 11:08 AM, Keeley Abbott wrote: > Hi All, > > So, I am taking a Functional Programming class this fall, and I have > struggling to understand how to build types and functions correctly. For > some reason it just isn?t clicking. I have the following module I am > working on, and I need some guidance. > > ? Variable names > type Name = String > > ? An environment for looking up the value of a variable > type Env = Name -> Maybe Int > > ? An empty environment > empty :: Env > empty env = Nothing > > ? Set a variable to a value in the environment if it doesn?t already exist > set :: Name -> Int -> Env -> Env > set x i e = \y -> if x == y then (Just i) else e y > > ? Lookup the value of a variable in the environment > get :: Name -> Env -> Int > get x env = ?? (I previously had ?type Env = Name -> Int?, so this was > working with env x, but we had to change empty to be something other than > just a runtime error, which is why I made Env = Name -> Maybe Int) > > ?Remove a variable from the environment > unset :: Name -> Env -> Env > unset x e = \y -> if x == y then empty x else env y > > At this point I don?t know how to fix get, so I get an int to display (it > keeps telling me it can?t match the type ?Maybe Int? with the expected type > ?Int?). And I don?t know where to go from there to create getOr, setAll, > and mapEnv functions, because I am just not understanding what I am doing. > For the most part I have been doing simpler things that I could just mess > with the functions until they work, but even at that I?m not getting HOW > they work? Any assistance or instruction on how I can GET what I am trying > to do would be greatly appreciated. > > Thanks, > Kallarhynn > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From frankdmartinez at gmail.com Sat Oct 18 22:37:18 2014 From: frankdmartinez at gmail.com (Frank) Date: Sat, 18 Oct 2014 18:37:18 -0400 Subject: [Haskell-beginners] Functors and Applicatives; I'm just not getting it ... Message-ID: I've had a go at LYAH and CIS 194 and the Typeclassopedia and I just don't get get functors and applicatives. I'm simply not understanding them, what the various symbols/keywords mean, what they represent, how to think of them, etc. Nothing. Is there any kind of documented model I should be considering? Is there a "functors and applicatives for Dummies" I should read? Should I just give it up, not bother with Haskell and just stick to scheme/ruby/C++? -- P.S.: I prefer to be reached on BitMessage at BM-2D8txNiU7b84d2tgqvJQdgBog6A69oDAx6 -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at adamflott.com Sat Oct 18 22:45:53 2014 From: adam at adamflott.com (Adam Flott) Date: Sat, 18 Oct 2014 18:45:53 -0400 Subject: [Haskell-beginners] Functors and Applicatives; I'm just not getting it ... In-Reply-To: References: Message-ID: <20141018184553.e86060012e41db18718a8e84@adamflott.com> On Sat, 18 Oct 2014 18:37:18 -0400 Frank wrote: > Is there a "functors and applicatives for Dummies" I should > read? Should I just give it up, not bother with Haskell and just stick to > scheme/ruby/C++? > Give this visual tutorial a whirl, http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html And then play around with http://hackage.haskell.org/package/optparse-applicative Those 2 resources helped reinforce my understanding. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 473 bytes Desc: not available URL: From apfelmus at quantentunnel.de Sun Oct 19 07:55:38 2014 From: apfelmus at quantentunnel.de (Heinrich Apfelmus) Date: Sun, 19 Oct 2014 09:55:38 +0200 Subject: [Haskell-beginners] latest Haskell Platform build fails In-Reply-To: <54425FCD.50104@fuuzetsu.co.uk> References: <543EB50E.3070406@gmail.com> <5440265B.4060308@fuuzetsu.co.uk> <54402E97.5060207@gmail.com> <54425A15.7090400@gmail.com> <54425FCD.50104@fuuzetsu.co.uk> Message-ID: Mateusz Kowalczyk wrote: > On 10/18/2014 01:16 PM, Michael Martin wrote: >> >> I find it astonishing that build/install fails because it finds >> that a dependency that it needs is already installed. This is >> totally unreasonable. I was really looking forward to experimenting >> with Cloud Haskell, but the pain of installation, coupled with >> Haskell's well-known issues with "dependency hell", have soured me >> on Haskell. The language itself is amazing - I really like it. But >> I'm afraid that the dysfunctional nature of the Haskell ecosystem >> is driving me back to Erlang/OTP. OTP has proven to be industrial >> strength. I hope that someday (soon), Haskell will be able to claim >> that, as well. >> > > Why don't you use [1] instead of getting the source binary and > finding yourself struggling? It comes with GHC. > > [1]: http://www.haskell.org/platform/linux.html#binary Indeed. Michael, don't make this harder on yourself than it needs to be. I know, you're using Linux, but it's just easier to download the binary and run the installer. Trying to compile source code in an ecosystem that you are not familiar with yet is likely to give you headaches. The download site for GHC explicitly says "Stop! For most users, we recommend installing the Haskell Platform instead of GHC" in big red letters. Also, Michael, you don't actually have to install the platform. You *already have* a working Haskell environment, as you managed to install GHC and cabal just fine. Besides the packaging, the Haskell platform just contains some useful packages, which you can easily install after the fact via cabal. Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com From karl at karlv.net Sun Oct 19 08:20:07 2014 From: karl at karlv.net (Karl Voelker) Date: Sun, 19 Oct 2014 01:20:07 -0700 Subject: [Haskell-beginners] Functors and Applicatives; I'm just not getting it ... In-Reply-To: References: Message-ID: <31EE471C-6A85-4ABD-BE48-08762E86E945@karlv.net> I suggest that you ignore applicatives for now and just focus on plain-old functors. They are the simplest part, and once you are confident in dealing with them, adding on applicatives will be much easier. And, although it can be difficult when you are really lost, if you can ask some more specific questions, this list will provide plenty of answers. -Karl > On Oct 18, 2014, at 3:37 PM, Frank wrote: > > I've had a go at LYAH and CIS 194 and the Typeclassopedia and I just don't get get functors and applicatives. I'm simply not understanding them, what the various symbols/keywords mean, what they represent, how to think of them, etc. Nothing. Is there any kind of documented model I should be considering? Is there a "functors and applicatives for Dummies" I should read? Should I just give it up, not bother with Haskell and just stick to scheme/ruby/C++? > > -- > P.S.: I prefer to be reached on BitMessage at BM-2D8txNiU7b84d2tgqvJQdgBog6A69oDAx6 > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners From edwards.benj at gmail.com Sun Oct 19 08:46:46 2014 From: edwards.benj at gmail.com (Benjamin Edwards) Date: Sun, 19 Oct 2014 01:46:46 -0700 (PDT) Subject: [Haskell-beginners] Functors and Applicatives; I'm just not getting it ... In-Reply-To: <31EE471C-6A85-4ABD-BE48-08762E86E945@karlv.net> References: <31EE471C-6A85-4ABD-BE48-08762E86E945@karlv.net> Message-ID: <1413708406546.e64bc258@Nodemailer> The only thing I feel to recommend given the generality of the question is to say: Pick some concrete instances of Functor, and play with them. Write a program with a failing component using 'Maybe' then see how much you can get done without pattern matching. Write a program over some lists and use fmap instead of map. Realise there isn't much more to fmap than a very general signature and some laws. See what the laws mean for the two concrete instances that you just used. Be satisfied. When you get a little further on your journey and see more interesting examples of the class you will see how useful it is. For instance most parser interfaces admit a functor instance. Which means that say you had a language with variable identifiers with a leading '$' sign followed by a string, writing a parser is super simple. Assume 'stringVar' is a 'Parser String' that parsers an identifier and 'Var' is a new type on strings for wrapping identifiers then Var `fmap` stringVar is a 'Parser Var'. I could offer again that a functor is nothing more than a principled way to change the 'generic type' of things that look like containers of type Foo, not sure if that is helpful, given your previous reading list. I hope this offers some insight. Haskell, like any learning endeavour requires you to just mess about with it until things start to click. You will miss out on a very rich learning experience if you cast it aside. Good luck! -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam.raizen at gmail.com Sun Oct 19 09:16:59 2014 From: adam.raizen at gmail.com (Adam Mesha) Date: Sun, 19 Oct 2014 12:16:59 +0300 Subject: [Haskell-beginners] Functors and Applicatives; I'm just not getting it ... In-Reply-To: References: Message-ID: The way I have come to understand them (based on playing around with them and various tutorials) is that a functor is a mappable, something that can be mapped. Or, since fmap is equivalent to liftM, you could call them liftables. So if I have a function of type a -> b and a functor (let's say Maybe), then it makes sense that I can automatically create a function Maybe a -> Maybe b (thus lifting the function into the Maybe functor, or mapping a to b through (over/using) the Maybe functor). 2014-10-19 1:37 GMT+03:00 Frank : > I've had a go at LYAH and CIS 194 and the Typeclassopedia and I just don't > get get functors and applicatives. I'm simply not understanding them, what > the various symbols/keywords mean, what they represent, how to think of > them, etc. Nothing. Is there any kind of documented model I should be > considering? Is there a "functors and applicatives for Dummies" I should > read? Should I just give it up, not bother with Haskell and just stick to > scheme/ruby/C++? > > -- > P.S.: I prefer to be reached on BitMessage at > BM-2D8txNiU7b84d2tgqvJQdgBog6A69oDAx6 > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -- Adam Mesha Life is either a daring adventure, or nothing. - Helen Keller -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam.raizen at gmail.com Sun Oct 19 13:45:17 2014 From: adam.raizen at gmail.com (Adam Mesha) Date: Sun, 19 Oct 2014 16:45:17 +0300 Subject: [Haskell-beginners] latest Haskell Platform build fails In-Reply-To: References: <543EB50E.3070406@gmail.com> <5440265B.4060308@fuuzetsu.co.uk> <54402E97.5060207@gmail.com> <54425A15.7090400@gmail.com> Message-ID: 2014-10-18 22:09 GMT+03:00 emacstheviking : > Lurker speaks: I too came to the same conclusion as Michael a long time > back; I absolutely love Haskell but sooner or later it seemed to me that > the "dependancy hell" would kick in just when you least needed / expected > it to. It is the single biggest put off for me now to consider using it. > Does this dependency hell problem still exist when you use cabal sandboxes? -- Adam Mesha Life is either a daring adventure, or nothing. - Helen Keller -------------- next part -------------- An HTML attachment was scrubbed... URL: From frankdmartinez at gmail.com Sun Oct 19 13:51:33 2014 From: frankdmartinez at gmail.com (Frank) Date: Sun, 19 Oct 2014 09:51:33 -0400 Subject: [Haskell-beginners] Functors and Applicatives; I'm just not getting it ... In-Reply-To: <31EE471C-6A85-4ABD-BE48-08762E86E945@karlv.net> References: <31EE471C-6A85-4ABD-BE48-08762E86E945@karlv.net> Message-ID: Thanks but I think this misses the point a bit. A some point in time, I will need an explanation about applicatives and teg supposedly best documentation (or at least the documentation I see advocated in numerous places) seems really bad at providing that explanation, a point I find worrisome. I know myself well enough to say becoming comfortable with functors will not make understanding applicatives any easier if the applicatives explanation is not clear and, right now, the explanation is not clear. On Sunday, October 19, 2014, Karl Voelker wrote: > I suggest that you ignore applicatives for now and just focus on plain-old > functors. They are the simplest part, and once you are confident in dealing > with them, adding on applicatives will be much easier. > > And, although it can be difficult when you are really lost, if you can ask > some more specific questions, this list will provide plenty of answers. > > -Karl > > > On Oct 18, 2014, at 3:37 PM, Frank > wrote: > > > > I've had a go at LYAH and CIS 194 and the Typeclassopedia and I just > don't get get functors and applicatives. I'm simply not understanding them, > what the various symbols/keywords mean, what they represent, how to think > of them, etc. Nothing. Is there any kind of documented model I should be > considering? Is there a "functors and applicatives for Dummies" I should > read? Should I just give it up, not bother with Haskell and just stick to > scheme/ruby/C++? > > > > -- > > P.S.: I prefer to be reached on BitMessage at > BM-2D8txNiU7b84d2tgqvJQdgBog6A69oDAx6 > > _______________________________________________ > > Beginners mailing list > > Beginners at haskell.org > > http://www.haskell.org/mailman/listinfo/beginners > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > -- P.S.: I prefer to be reached on BitMessage at BM-2D8txNiU7b84d2tgqvJQdgBog6A69oDAx6 -------------- next part -------------- An HTML attachment was scrubbed... URL: From erikprice at gmail.com Sun Oct 19 14:39:29 2014 From: erikprice at gmail.com (Erik Price) Date: Sun, 19 Oct 2014 10:39:29 -0400 Subject: [Haskell-beginners] Functors and Applicatives; I'm just not getting it ... In-Reply-To: References: <31EE471C-6A85-4ABD-BE48-08762E86E945@karlv.net> Message-ID: As the name implies, the concept of an applicative functor builds on the concept of a functor, so it will help to start with a thorough understanding of functors. A functor allows you to lift a function of Foo -> Bar into some context of Foo, so that when the expression is finally evaluated you will end up with a value of Bar in that context. An applicative functor allows you to lift a function of an arbitrary number of parameters, such as Foo -> Bar -> Baz, into that number of values (of those types) already in contexts. So the example function could be applied to a context of Foo and a context of Bar, and would ultimately evaluate to a context of Baz. e On Sunday, October 19, 2014, Frank wrote: > Thanks but I think this misses the point a bit. A some point in time, I > will need an explanation about applicatives and teg supposedly best > documentation (or at least the documentation I see advocated in numerous > places) seems really bad at providing that explanation, a point I find > worrisome. I know myself well enough to say becoming comfortable with > functors will not make understanding applicatives any easier if the > applicatives explanation is not clear and, right now, the explanation is > not clear. > > On Sunday, October 19, 2014, Karl Voelker > wrote: > >> I suggest that you ignore applicatives for now and just focus on >> plain-old functors. They are the simplest part, and once you are confident >> in dealing with them, adding on applicatives will be much easier. >> >> And, although it can be difficult when you are really lost, if you can >> ask some more specific questions, this list will provide plenty of answers. >> >> -Karl >> >> > On Oct 18, 2014, at 3:37 PM, Frank wrote: >> > >> > I've had a go at LYAH and CIS 194 and the Typeclassopedia and I just >> don't get get functors and applicatives. I'm simply not understanding them, >> what the various symbols/keywords mean, what they represent, how to think >> of them, etc. Nothing. Is there any kind of documented model I should be >> considering? Is there a "functors and applicatives for Dummies" I should >> read? Should I just give it up, not bother with Haskell and just stick to >> scheme/ruby/C++? >> > >> > -- >> > P.S.: I prefer to be reached on BitMessage at >> BM-2D8txNiU7b84d2tgqvJQdgBog6A69oDAx6 >> > _______________________________________________ >> > Beginners mailing list >> > Beginners at haskell.org >> > http://www.haskell.org/mailman/listinfo/beginners >> _______________________________________________ >> Beginners mailing list >> Beginners at haskell.org >> http://www.haskell.org/mailman/listinfo/beginners >> > > > -- > P.S.: I prefer to be reached on BitMessage at > BM-2D8txNiU7b84d2tgqvJQdgBog6A69oDAx6 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fa-ml at ariis.it Sun Oct 19 14:48:58 2014 From: fa-ml at ariis.it (Francesco Ariis) Date: Sun, 19 Oct 2014 16:48:58 +0200 Subject: [Haskell-beginners] Functors and Applicatives; I'm just not getting it ... In-Reply-To: References: <31EE471C-6A85-4ABD-BE48-08762E86E945@karlv.net> Message-ID: <20141019144858.GA13866@x60s.casa> On Sun, Oct 19, 2014 at 09:51:33AM -0400, Frank wrote: > Thanks but I think this misses the point a bit. A some point in time, I > will need an explanation about applicatives and teg supposedly best > documentation (or at least the documentation I see advocated in numerous > places) seems really bad at providing that explanation, a point I find > worrisome. I know myself well enough to say becoming comfortable with > functors will not make understanding applicatives any easier if the > applicatives explanation is not clear and, right now, the explanation is > not clear. Applicatives are Functors, so a solid understanding of the latter is required to grasp the former. - Did you go through all the examples from Learn You a Haskell [1]? - Could you write the `instance Functor Tree` if asked? - There are instances like `Functor ((->) r)` and `Functor ((,) a)`; how do they behave? Could you rewrite them *not* to follow Functor laws? Once you feel comfortable with the more mind bending cases of Functor, Applicative will be way easier to understand. [1] http://learnyouahaskell.com/making-our-own-types-and-typeclasses#the-functor-typeclass From jeffbrown.the at gmail.com Sun Oct 19 20:13:50 2014 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Sun, 19 Oct 2014 13:13:50 -0700 Subject: [Haskell-beginners] Is working with Haskell easier on Linux than on a Mac? Message-ID: I have read that Haskell is easier to work with on Linux than on Windows. Is Haskell on Linux also easier than Haskell on OS X? I'm trying to do realtime OSC output from Haskell, because concurrency in Python is hard. Brandon Allbery on the haskell-cafe list, told me "chrt" and "sched_setscheduler" would be helpful. At the shell prompt I found that my system (OS X 10.9) does not recognize "chrt". I found a library on Hackage, "posix-realtime", that claims Mac compatibility and has a "sched_setscheduler" function, but my attempts to install it fail: sh-3.2# cabal install posix-realtime Resolving dependencies... Downloading unix-2.3.2.0... Configuring unix-2.3.2.0... Building unix-2.3.2.0... Failed to install unix-2.3.2.0 Last 10 lines of the build log ( /var/root/.cabal/logs/unix-2.3.2.0.log ): Building unix-2.3.2.0... Preprocessing library unix-2.3.2.0... dist/build/System/Posix/Signals.hs:124:10: fatal error: 'Signals.h' file not found #include "Signals.h" ^ 1 error generated. Even if I found a solution to this particular problem, I'm worried I'll keep running into similar ones, because I'm sure I'll keep trying new packages. Would this kind of work be substantially easier if I were using, say, Linux Mint? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ryan.trinkle at gmail.com Sun Oct 19 20:22:29 2014 From: ryan.trinkle at gmail.com (Ryan Trinkle) Date: Sun, 19 Oct 2014 16:22:29 -0400 Subject: [Haskell-beginners] Is working with Haskell easier on Linux than on a Mac? In-Reply-To: References: Message-ID: Hi Jeffrey, Haskell is what convinced me to switch to Linux (from Windows). Since then, I've occasionally worked with Haskell on OS X, and I've found it to have more snags than working with Haskell on Linux. Workarounds are usually forthcoming though, since a substantial fraction of Haskell users do use OS X. Generally, there seems to be a bit more friction using Haskell with OS X than with Linux, but it can definitely be overcome. Of course, Linux tends to have a bit more friction in dealing with the hardware, especially Apple hardware. Ryan On Sun, Oct 19, 2014 at 4:13 PM, Jeffrey Brown wrote: > I have read that Haskell is easier to work with on Linux than on Windows. > Is Haskell on Linux also easier than Haskell on OS X? > > I'm trying to do realtime OSC output from Haskell, because concurrency in > Python is hard. Brandon Allbery on the haskell-cafe list, told me "chrt" > and "sched_setscheduler" would be helpful. At the shell prompt I found that > my system (OS X 10.9) does not recognize "chrt". I found a library on > Hackage, "posix-realtime", that claims Mac compatibility and has a > "sched_setscheduler" function, but my attempts to install it fail: > > sh-3.2# cabal install posix-realtime > Resolving dependencies... > Downloading unix-2.3.2.0... > Configuring unix-2.3.2.0... > Building unix-2.3.2.0... > Failed to install unix-2.3.2.0 > Last 10 lines of the build log ( /var/root/.cabal/logs/unix-2.3.2.0.log ): > Building unix-2.3.2.0... > Preprocessing library unix-2.3.2.0... > dist/build/System/Posix/Signals.hs:124:10: > fatal error: 'Signals.h' file not found > #include "Signals.h" > ^ > 1 error generated. > > Even if I found a solution to this particular problem, I'm worried I'll > keep running into similar ones, because I'm sure I'll keep trying new > packages. Would this kind of work be substantially easier if I were using, > say, Linux Mint? > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffbrown.the at gmail.com Sun Oct 19 20:51:03 2014 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Sun, 19 Oct 2014 13:51:03 -0700 Subject: [Haskell-beginners] Is working with Haskell easier on Linux than on a Mac? In-Reply-To: References: Message-ID: Thanks, Ryan! On Sun, Oct 19, 2014 at 1:22 PM, Ryan Trinkle wrote: > Hi Jeffrey, > > Haskell is what convinced me to switch to Linux (from Windows). Since > then, I've occasionally worked with Haskell on OS X, and I've found it to > have more snags than working with Haskell on Linux. Workarounds are > usually forthcoming though, since a substantial fraction of Haskell users > do use OS X. Generally, there seems to be a bit more friction using > Haskell with OS X than with Linux, but it can definitely be overcome. Of > course, Linux tends to have a bit more friction in dealing with the > hardware, especially Apple hardware. > > > Ryan > > On Sun, Oct 19, 2014 at 4:13 PM, Jeffrey Brown > wrote: > >> I have read that Haskell is easier to work with on Linux than on Windows. >> Is Haskell on Linux also easier than Haskell on OS X? >> >> I'm trying to do realtime OSC output from Haskell, because concurrency in >> Python is hard. Brandon Allbery on the haskell-cafe list, told me "chrt" >> and "sched_setscheduler" would be helpful. At the shell prompt I found that >> my system (OS X 10.9) does not recognize "chrt". I found a library on >> Hackage, "posix-realtime", that claims Mac compatibility and has a >> "sched_setscheduler" function, but my attempts to install it fail: >> >> sh-3.2# cabal install posix-realtime >> Resolving dependencies... >> Downloading unix-2.3.2.0... >> Configuring unix-2.3.2.0... >> Building unix-2.3.2.0... >> Failed to install unix-2.3.2.0 >> Last 10 lines of the build log ( /var/root/.cabal/logs/unix-2.3.2.0.log ): >> Building unix-2.3.2.0... >> Preprocessing library unix-2.3.2.0... >> dist/build/System/Posix/Signals.hs:124:10: >> fatal error: 'Signals.h' file not found >> #include "Signals.h" >> ^ >> 1 error generated. >> >> Even if I found a solution to this particular problem, I'm worried I'll >> keep running into similar ones, because I'm sure I'll keep trying new >> packages. Would this kind of work be substantially easier if I were using, >> say, Linux Mint? >> >> _______________________________________________ >> Beginners mailing list >> Beginners at haskell.org >> http://www.haskell.org/mailman/listinfo/beginners >> >> > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From objitsu at gmail.com Sun Oct 19 21:00:00 2014 From: objitsu at gmail.com (emacstheviking) Date: Sun, 19 Oct 2014 22:00:00 +0100 Subject: [Haskell-beginners] latest Haskell Platform build fails In-Reply-To: References: <543EB50E.3070406@gmail.com> <5440265B.4060308@fuuzetsu.co.uk> <54402E97.5060207@gmail.com> <54425A15.7090400@gmail.com> Message-ID: I guess it shouldn't but since they (the sandboxes) became more "common place" I have yet to find a reason to try them. >From what I see on blogs and lists though I don't think it does really cure the problems per se. IIUIC the most common cause of troubles is when dependencies between packages cause issues and that can happen even in a sandbox. Perhaps I will try again sometime soon but I am knee deep in Prolog these days, and PHP :( On 19 October 2014 14:45, Adam Mesha wrote: > 2014-10-18 22:09 GMT+03:00 emacstheviking : > >> Lurker speaks: I too came to the same conclusion as Michael a long time >> back; I absolutely love Haskell but sooner or later it seemed to me that >> the "dependancy hell" would kick in just when you least needed / expected >> it to. It is the single biggest put off for me now to consider using it. >> > > Does this dependency hell problem still exist when you use cabal sandboxes? > > -- > Adam Mesha > Life is either a daring adventure, or nothing. - Helen Keller > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mmartin4242 at gmail.com Mon Oct 20 00:25:38 2014 From: mmartin4242 at gmail.com (Michael Martin) Date: Sun, 19 Oct 2014 19:25:38 -0500 Subject: [Haskell-beginners] Is working with Haskell easier on Linux than on a Mac? In-Reply-To: References: Message-ID: <54445682.6010405@gmail.com> As a Linux bigot myself, I'd say go with Linux. However, if you are more comfortable with OS X, I'm gonna guess that installing X Code (or whatever the compiler package is called these days) ought to make this one particular problem (header file not found) go away. On 10/19/2014 03:51 PM, Jeffrey Brown wrote: > Thanks, Ryan! > > On Sun, Oct 19, 2014 at 1:22 PM, Ryan Trinkle > wrote: > > Hi Jeffrey, > > Haskell is what convinced me to switch to Linux (from Windows). > Since then, I've occasionally worked with Haskell on OS X, and > I've found it to have more snags than working with Haskell on > Linux. Workarounds are usually forthcoming though, since a > substantial fraction of Haskell users do use OS X. Generally, > there seems to be a bit more friction using Haskell with OS X than > with Linux, but it can definitely be overcome. Of course, Linux > tends to have a bit more friction in dealing with the hardware, > especially Apple hardware. > > > Ryan > > On Sun, Oct 19, 2014 at 4:13 PM, Jeffrey Brown > > wrote: > > I have read that Haskell is easier to work with on Linux than > on Windows. Is Haskell on Linux also easier than Haskell on OS X? > > I'm trying to do realtime OSC output from Haskell, because > concurrency in Python is hard. Brandon Allbery on the > haskell-cafe list, told me "chrt" and "sched_setscheduler" > would be helpful. At the shell prompt I found that my system > (OS X 10.9) does not recognize "chrt". I found a library on > Hackage, "posix-realtime", that claims Mac compatibility and > has a "sched_setscheduler" function, but my attempts to > install it fail: > > sh-3.2# cabal install posix-realtime > Resolving dependencies... > Downloading unix-2.3.2.0... > Configuring unix-2.3.2.0... > Building unix-2.3.2.0... > Failed to install unix-2.3.2.0 > Last 10 lines of the build log ( > /var/root/.cabal/logs/unix-2.3.2.0.log ): > Building unix-2.3.2.0... > Preprocessing library unix-2.3.2.0... > dist/build/System/Posix/Signals.hs:124:10: > fatal error: 'Signals.h' file not found > #include "Signals.h" > ^ > 1 error generated. > > Even if I found a solution to this particular problem, I'm > worried I'll keep running into similar ones, because I'm sure > I'll keep trying new packages. Would this kind of work be > substantially easier if I were using, say, Linux Mint? > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners -------------- next part -------------- An HTML attachment was scrubbed... URL: From mmartin4242 at gmail.com Mon Oct 20 00:27:56 2014 From: mmartin4242 at gmail.com (Michael Martin) Date: Sun, 19 Oct 2014 19:27:56 -0500 Subject: [Haskell-beginners] latest Haskell Platform build fails In-Reply-To: References: <543EB50E.3070406@gmail.com> <5440265B.4060308@fuuzetsu.co.uk> <54402E97.5060207@gmail.com> <54425A15.7090400@gmail.com> <54425FCD.50104@fuuzetsu.co.uk> Message-ID: <5444570C.7060006@gmail.com> On 10/19/2014 02:55 AM, Heinrich Apfelmus wrote: > Mateusz Kowalczyk wrote: >> On 10/18/2014 01:16 PM, Michael Martin wrote: >>> >>> I find it astonishing that build/install fails because it finds >>> that a dependency that it needs is already installed. This is >>> totally unreasonable. I was really looking forward to experimenting >>> with Cloud Haskell, but the pain of installation, coupled with >>> Haskell's well-known issues with "dependency hell", have soured me >>> on Haskell. The language itself is amazing - I really like it. But >>> I'm afraid that the dysfunctional nature of the Haskell ecosystem >>> is driving me back to Erlang/OTP. OTP has proven to be industrial >>> strength. I hope that someday (soon), Haskell will be able to claim >>> that, as well. >>> >> >> Why don't you use [1] instead of getting the source binary and >> finding yourself struggling? It comes with GHC. >> >> [1]: http://www.haskell.org/platform/linux.html#binary > > Indeed. Michael, don't make this harder on yourself than it needs to > be. I know, you're using Linux, but it's just easier to download the > binary and run the installer. Trying to compile source code in an > ecosystem that you are not familiar with yet is likely to give you > headaches. The download site for GHC explicitly says "Stop! For most > users, we recommend installing the Haskell Platform instead of GHC" in > big red letters. > > Also, Michael, you don't actually have to install the platform. You > *already have* a working Haskell environment, as you managed to > install GHC and cabal just fine. Besides the packaging, the Haskell > platform just contains some useful packages, which you can easily > install after the fact via cabal. > > > Best regards, > Heinrich Apfelmus > > -- > http://apfelmus.nfshost.com > Thanks for the clarification, Heinrich. It was not apparent to me just what the Platform package represented. I'll continue to evaluate Haskell. > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners From allbery.b at gmail.com Mon Oct 20 00:29:51 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 19 Oct 2014 20:29:51 -0400 Subject: [Haskell-beginners] Is working with Haskell easier on Linux than on a Mac? In-Reply-To: <54445682.6010405@gmail.com> References: <54445682.6010405@gmail.com> Message-ID: On Sun, Oct 19, 2014 at 8:25 PM, Michael Martin wrote: > As a Linux bigot myself, I'd say go with Linux. However, if you are more > comfortable with OS X, I'm > gonna guess that installing X Code (or whatever the compiler package is > called these days) ought > to make this one particular problem (header file not found) go away. > I'd guess otherwise, because "" in a #include (having peeked back at the original message) means it's a locally defined file, not a system header. That said, it doesn't rule out configure not having created it because it couldn't find some system header --- but the Command Line Tools should be sufficient for that. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From mmartin4242 at gmail.com Mon Oct 20 00:34:27 2014 From: mmartin4242 at gmail.com (Michael Martin) Date: Sun, 19 Oct 2014 19:34:27 -0500 Subject: [Haskell-beginners] Is working with Haskell easier on Linux than on a Mac? In-Reply-To: References: <54445682.6010405@gmail.com> Message-ID: <54445893.50201@gmail.com> On 10/19/2014 07:29 PM, Brandon Allbery wrote: > On Sun, Oct 19, 2014 at 8:25 PM, Michael Martin > wrote: > > As a Linux bigot myself, I'd say go with Linux. However, if you > are more comfortable with OS X, I'm > gonna guess that installing X Code (or whatever the compiler > package is called these days) ought > to make this one particular problem (header file not found) go away. > > > I'd guess otherwise, because "" in a #include (having peeked back at > the original message) means it's a locally defined file, not a system > header. That said, it doesn't rule out configure not having created it > because it couldn't find some system header --- but the Command Line > Tools should be sufficient for that. > Signals.h provides an interface to OS process signals, and should be provided by either the compiler package, or by the operating system itself. A quick google for "Mac OS/X Signals.h" tells me that this header file is, indeed, provided by the X-Code compiler package. > -- > brandon s allbery kf8nh sine nomine associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffbrown.the at gmail.com Mon Oct 20 00:34:57 2014 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Sun, 19 Oct 2014 17:34:57 -0700 Subject: [Haskell-beginners] Is working with Haskell easier on Linux than on a Mac? In-Reply-To: <54445682.6010405@gmail.com> References: <54445682.6010405@gmail.com> Message-ID: Long ago (2007?) I switched from Linux to Mac because I could not figure out how to do music on Linux -- in particular I remember audio interfaces were particularly difficult to configure -- and on the Mac everything "just worked". As my toolset diverges from the standard Mac audio rigs, though, that it "just works" seems to become less and less true. I've got XCode and the command line tools installed already. Installing those certainly solved some problems, but alas not all of them. On Sun, Oct 19, 2014 at 5:25 PM, Michael Martin wrote: > As a Linux bigot myself, I'd say go with Linux. However, if you are more > comfortable with OS X, I'm > gonna guess that installing X Code (or whatever the compiler package is > called these days) ought > to make this one particular problem (header file not found) go away. > > > On 10/19/2014 03:51 PM, Jeffrey Brown wrote: > > Thanks, Ryan! > > On Sun, Oct 19, 2014 at 1:22 PM, Ryan Trinkle > wrote: > >> Hi Jeffrey, >> >> Haskell is what convinced me to switch to Linux (from Windows). Since >> then, I've occasionally worked with Haskell on OS X, and I've found it to >> have more snags than working with Haskell on Linux. Workarounds are >> usually forthcoming though, since a substantial fraction of Haskell users >> do use OS X. Generally, there seems to be a bit more friction using >> Haskell with OS X than with Linux, but it can definitely be overcome. Of >> course, Linux tends to have a bit more friction in dealing with the >> hardware, especially Apple hardware. >> >> >> Ryan >> >> On Sun, Oct 19, 2014 at 4:13 PM, Jeffrey Brown >> wrote: >> >>> I have read that Haskell is easier to work with on Linux than on >>> Windows. Is Haskell on Linux also easier than Haskell on OS X? >>> >>> I'm trying to do realtime OSC output from Haskell, because concurrency >>> in Python is hard. Brandon Allbery on the haskell-cafe list, told me "chrt" >>> and "sched_setscheduler" would be helpful. At the shell prompt I found that >>> my system (OS X 10.9) does not recognize "chrt". I found a library on >>> Hackage, "posix-realtime", that claims Mac compatibility and has a >>> "sched_setscheduler" function, but my attempts to install it fail: >>> >>> sh-3.2# cabal install posix-realtime >>> Resolving dependencies... >>> Downloading unix-2.3.2.0... >>> Configuring unix-2.3.2.0... >>> Building unix-2.3.2.0... >>> Failed to install unix-2.3.2.0 >>> Last 10 lines of the build log ( >>> /var/root/.cabal/logs/unix-2.3.2.0.log ): >>> Building unix-2.3.2.0... >>> Preprocessing library unix-2.3.2.0... >>> dist/build/System/Posix/Signals.hs:124:10: >>> fatal error: 'Signals.h' file not found >>> #include "Signals.h" >>> ^ >>> 1 error generated. >>> >>> Even if I found a solution to this particular problem, I'm worried >>> I'll keep running into similar ones, because I'm sure I'll keep trying new >>> packages. Would this kind of work be substantially easier if I were using, >>> say, Linux Mint? >>> >>> _______________________________________________ >>> Beginners mailing list >>> Beginners at haskell.org >>> http://www.haskell.org/mailman/listinfo/beginners >>> >>> >> >> _______________________________________________ >> Beginners mailing list >> Beginners at haskell.org >> http://www.haskell.org/mailman/listinfo/beginners >> >> > > > _______________________________________________ > Beginners mailing listBeginners at haskell.orghttp://www.haskell.org/mailman/listinfo/beginners > > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Mon Oct 20 00:36:56 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 19 Oct 2014 20:36:56 -0400 Subject: [Haskell-beginners] Is working with Haskell easier on Linux than on a Mac? In-Reply-To: <54445893.50201@gmail.com> References: <54445682.6010405@gmail.com> <54445893.50201@gmail.com> Message-ID: On Sun, Oct 19, 2014 at 8:34 PM, Michael Martin wrote: > Signals.h provides an interface to OS process signals That is , not "Signals.h". And while case may be fungible on OS X, the trailing "s" is not. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Mon Oct 20 00:40:01 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 19 Oct 2014 20:40:01 -0400 Subject: [Haskell-beginners] Is working with Haskell easier on Linux than on a Mac? In-Reply-To: References: <54445682.6010405@gmail.com> <54445893.50201@gmail.com> Message-ID: On Sun, Oct 19, 2014 at 8:36 PM, Brandon Allbery wrote: > On Sun, Oct 19, 2014 at 8:34 PM, Michael Martin > wrote: > >> Signals.h provides an interface to OS process signals > > > That is , not "Signals.h". And while case may be fungible on OS > X, the trailing "s" is not. > To be quite clear: pyanfar:857 Z$ ls -l /usr/include/signal.h -r--r--r-- 1 root wheel 5318 Oct 17 05:41 /usr/include/signal.h pyanfar:858 Z$ pkgutil --file-info /usr/include/signal.h volume: / path: /usr/include/signal.h pkgid: com.apple.pkg.DevSDK_OSX109 pkg-version: 6.1.0.0.1.1413057044 install-time: 1413646296 uid: 0 gid: 0 mode: 444 -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From mmartin4242 at gmail.com Mon Oct 20 00:54:01 2014 From: mmartin4242 at gmail.com (Michael Martin) Date: Sun, 19 Oct 2014 19:54:01 -0500 Subject: [Haskell-beginners] Is working with Haskell easier on Linux than on a Mac? In-Reply-To: References: <54445682.6010405@gmail.com> <54445893.50201@gmail.com> Message-ID: <54445D29.7080605@gmail.com> On 10/19/2014 07:36 PM, Brandon Allbery wrote: > On Sun, Oct 19, 2014 at 8:34 PM, Michael Martin > wrote: > > Signals.h provides an interface to OS process signals > > > That is , not "Signals.h". And while case may be fungible on > OS X, the trailing "s" is not > > -- > brandon s allbery kf8nh sine nomine associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net > > You are quite right. My apologies for jumping the gun on that one. > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners -------------- next part -------------- An HTML attachment was scrubbed... URL: From voldermort at hotmail.com Mon Oct 20 09:32:18 2014 From: voldermort at hotmail.com (Jeremy) Date: Mon, 20 Oct 2014 09:32:18 +0000 (UTC) Subject: [Haskell-beginners] =?utf-8?q?GhcDynamic_and_DYNAMIC=5FGHC=5FPROG?= =?utf-8?q?RAMS?= Message-ID: mk/config.mk contains GhcDynamic and DYNAMIC_GHC_PROGRAMS variables. What is the difference between them? From the names and comments, it looks like DYNAMIC_GHC_PROGRAMS controls whether all the GHC binaries will be static or dynamically linked, but GhcDynamic only controls the GHC executable? From defigueiredo at ucdavis.edu Mon Oct 20 18:57:17 2014 From: defigueiredo at ucdavis.edu (Dimitri DeFigueiredo) Date: Mon, 20 Oct 2014 12:57:17 -0600 Subject: [Haskell-beginners] learning lazy evaluation Message-ID: <54455B0D.90902@ucdavis.edu> I found an interesting situation while making recursive calls that I am trying to understand. I re-wrote the 'minimum' function from the prelude as such: minimum_bug :: (Ord a) => [a] -> a minimum_bug [x] = x minimum_bug (x:xs) | x > minimum_bug xs = minimum_bug xs | otherwise = x (I understand I should be using something like "minbug xs = foldr1 min xs" for this, but bare with me) The interesting thing is that the function has exponential time behavior. In a way, that makes sense as I am making two recursive calls. But I was expecting GHC to be smart enough to transform it into something like: minimum_bug' :: (Ord a) => [a] -> a minimum_bug' [x] = x minimum_bug' (x:xs) | x > y = y | otherwise = x where y = minimum_bug' xs (This one always works as expected) I understand that lazy evaluation implies memoization in some cases. When does GHC only use memoization to avoid this kind of behavior? Another interesting fact is that in my simple tests the exponential behavior does NOT occur when I pass the function a list in sorted order. main = do putStrLn "started - in order list" putStrLn $ show $ minimum_bug [1..30000] -- no problem putStrLn "started - out of order list" putStrLn $ show $ minimum_bug [27,26..1] -- don't do this with large numbers! putStrLn "done!" It's not clear to me how the sorted list is able to escape the exponential slow down. Cheers, Dimitri From bob at redivi.com Mon Oct 20 19:21:00 2014 From: bob at redivi.com (Bob Ippolito) Date: Mon, 20 Oct 2014 12:21:00 -0700 Subject: [Haskell-beginners] learning lazy evaluation In-Reply-To: <54455B0D.90902@ucdavis.edu> References: <54455B0D.90902@ucdavis.edu> Message-ID: On Mon, Oct 20, 2014 at 11:57 AM, Dimitri DeFigueiredo < defigueiredo at ucdavis.edu> wrote: > I found an interesting situation while making recursive calls that I am > trying to understand. I re-wrote the 'minimum' function from the prelude as > such: > > minimum_bug :: (Ord a) => [a] -> a > minimum_bug [x] = x > minimum_bug (x:xs) | x > minimum_bug xs = minimum_bug xs > | otherwise = x > > (I understand I should be using something like "minbug xs = foldr1 min xs" > for this, but bare with me) > > The interesting thing is that the function has exponential time behavior. > In a way, that makes sense as I am making two recursive calls. But I was > expecting GHC to be smart enough to transform it into something like: > > minimum_bug' :: (Ord a) => [a] -> a > minimum_bug' [x] = x > minimum_bug' (x:xs) | x > y = y > | otherwise = x > where y = minimum_bug' xs > > (This one always works as expected) > > I understand that lazy evaluation implies memoization in some cases. > When does GHC only use memoization to avoid this kind of behavior? > I assume you're trying this with ghci or compiling without optimizations. In these scenarios GHC isn't doing anything clever at all, so there will be two separate calls to minimum_bug in each recursion. Using a variable ensures that this value is explicitly shared between the guard and the result in the list. This section of Parallel and Concurrent Programming in Haskell helped me understand Haskell's non-strict evaluation model: http://chimera.labs.oreilly.com/books/1230000000929/ch02.html#sec_par-eval-whnf Another interesting fact is that in my simple tests the exponential > behavior does NOT occur when I pass the function a list in sorted order. > > main = do putStrLn "started - in order list" > putStrLn $ show $ minimum_bug [1..30000] -- no problem > putStrLn "started - out of order list" > putStrLn $ show $ minimum_bug [27,26..1] -- don't do this with > large numbers! > putStrLn "done!" > > It's not clear to me how the sorted list is able to escape the exponential > slow down. > Because displaying the value doesn't have any recursion to it, since it's `x` and not `minumum_bug x`. You can walk through the execution. -- Original call minimum_bug [1, 2] -- Expand the first matching pattern minimum_bug (1:[2]) | 1 > minimum_bug [2] -- minimum_bug [2] is forced due to the guard -- Evaluate minimum_bug [2] minimum_bug [2] -> 2 -- Step back to the guard we were trying to evaluate minimum_bug (1:[2]) | 1 > 2 1 > 2 -> False -- Guard fails, go to the otherwise case | otherwise = 1 -> 1 The `1` is already in normal form, so `putStrLn . show` doesn't have to do any extra reductions. If you walk through with `minimum_bug [2, 1]` you'll end up with `minimum_bug [1]` as the result, which is not in normal form and thus requires additional evaluation when `putStrLn . show` attempts to display it. If you use a larger list and walk through, you can see that the amount of redundant evaluation explodes when the list is in descending order. -bob -------------- next part -------------- An HTML attachment was scrubbed... URL: From defigueiredo at ucdavis.edu Mon Oct 20 21:18:36 2014 From: defigueiredo at ucdavis.edu (Dimitri DeFigueiredo) Date: Mon, 20 Oct 2014 15:18:36 -0600 Subject: [Haskell-beginners] learning lazy evaluation In-Reply-To: References: <54455B0D.90902@ucdavis.edu> Message-ID: <54457C2C.1@ucdavis.edu> Thanks Bob. The (lack of) exponential explosion makes sense now. And, yes, I was using both ghci and ghc 7.6.3 without any flags. When memoization takes place is still a little murky to me, though. Figure 2.2 in that chapter of Simon Marlow's book has the kind of "aliasing" with the number '1' (two pointers pointing to the same location) that I thought would also happen with 'minimum_bug xs' , but I guess 1::Int is a special case that is different from other terms without optimization or the depiction is not accurate. I have a further question on that is troubling me. It seems that constructors are treated differently from other expressions when it comes to evaluation. The examples in the book show that: Prelude> let x = 1 + 2 :: Int Prelude> :sprint x x = _ In other words, x is just an unevaluated thunk. But at the same time: Prelude> let x = 1 + 2 :: Int Prelude> let z = (x,x) Prelude> :sprint z z = (_,_) So, 'z' has been evaluated to WHNF. I was expecting to get: Prelude> :sprint z z = _ Meaning, an unevaluated expression. Just like we did with 'x', but it seems z has already been partially evaluated. Am I getting this right? Are expressions with constructors evaluated differently? Why is :sprint z different from 'z = _' in this case? Thanks again, Dimitri On 20/10/14 13:21, Bob Ippolito wrote: > > > On Mon, Oct 20, 2014 at 11:57 AM, Dimitri DeFigueiredo > > wrote: > > I found an interesting situation while making recursive calls that > I am trying to understand. I re-wrote the 'minimum' function from > the prelude as such: > > minimum_bug :: (Ord a) => [a] -> a > minimum_bug [x] = x > minimum_bug (x:xs) | x > minimum_bug xs = minimum_bug xs > | otherwise = x > > (I understand I should be using something like "minbug xs = foldr1 > min xs" for this, but bare with me) > > The interesting thing is that the function has exponential time > behavior. In a way, that makes sense as I am making two recursive > calls. But I was expecting GHC to be smart enough to transform it > into something like: > > minimum_bug' :: (Ord a) => [a] -> a > minimum_bug' [x] = x > minimum_bug' (x:xs) | x > y = y > | otherwise = x > where y = minimum_bug' xs > > (This one always works as expected) > > I understand that lazy evaluation implies memoization in some cases. > When does GHC only use memoization to avoid this kind of behavior? > > > I assume you're trying this with ghci or compiling without > optimizations. In these scenarios GHC isn't doing anything clever at > all, so there will be two separate calls to minimum_bug in each > recursion. Using a variable ensures that this value is explicitly > shared between the guard and the result in the list. > > This section of Parallel and Concurrent Programming in Haskell helped > me understand Haskell's non-strict evaluation model: > http://chimera.labs.oreilly.com/books/1230000000929/ch02.html#sec_par-eval-whnf > > Another interesting fact is that in my simple tests the > exponential behavior does NOT occur when I pass the function a > list in sorted order. > > main = do putStrLn "started - in order list" > putStrLn $ show $ minimum_bug [1..30000] -- no problem > putStrLn "started - out of order list" > putStrLn $ show $ minimum_bug [27,26..1] -- don't do > this with large numbers! > putStrLn "done!" > > It's not clear to me how the sorted list is able to escape the > exponential slow down. > > > Because displaying the value doesn't have any recursion to it, since > it's `x` and not `minumum_bug x`. > > You can walk through the execution. > > -- Original call > minimum_bug [1, 2] > -- Expand the first matching pattern > minimum_bug (1:[2]) | 1 > minimum_bug [2] > -- minimum_bug [2] is forced due to the guard > -- Evaluate minimum_bug [2] > minimum_bug [2] > -> 2 > -- Step back to the guard we were trying to evaluate > minimum_bug (1:[2]) | 1 > 2 > 1 > 2 > -> False > -- Guard fails, go to the otherwise case > | otherwise = 1 > -> 1 > > The `1` is already in normal form, so `putStrLn . show` doesn't have > to do any extra reductions. > > If you walk through with `minimum_bug [2, 1]` you'll end up with > `minimum_bug [1]` as the result, which is not in normal form and thus > requires additional evaluation when `putStrLn . show` attempts to > display it. If you use a larger list and walk through, you can see > that the amount of redundant evaluation explodes when the list is in > descending order. > > -bob > > > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob at redivi.com Tue Oct 21 15:43:07 2014 From: bob at redivi.com (Bob Ippolito) Date: Tue, 21 Oct 2014 08:43:07 -0700 Subject: [Haskell-beginners] learning lazy evaluation In-Reply-To: <54457C2C.1@ucdavis.edu> References: <54455B0D.90902@ucdavis.edu> <54457C2C.1@ucdavis.edu> Message-ID: That is an interesting observation. Haskell is defined to have non-strict evaluation, which basically means the evaluation must happen from the outside in. It does not guarantee laziness, so even in interpreted settings it doesn't *have* to create a thunk. What you're seeing is simply an implementation detail of GHC that's consistent with the Haskell language but inconsistent with the expectation that it should be maximally lazy. On Mon, Oct 20, 2014 at 2:18 PM, Dimitri DeFigueiredo < defigueiredo at ucdavis.edu> wrote: > Thanks Bob. > > The (lack of) exponential explosion makes sense now. And, yes, I was using > both ghci and ghc 7.6.3 without any flags. > > When memoization takes place is still a little murky to me, though. > Figure 2.2 in that chapter of Simon Marlow's book has the kind of > "aliasing" with the number '1' (two pointers pointing to the same location) > that I thought would also happen with 'minimum_bug xs' , but I guess 1::Int > is a special case that is different from other terms without optimization > or the depiction is not accurate. > > I have a further question on that is troubling me. It seems that > constructors are treated differently from other expressions when it comes > to evaluation. The examples in the book show that: > > Prelude> let x = 1 + 2 :: Int > Prelude> :sprint x > x = _ > > > In other words, x is just an unevaluated thunk. > But at the same time: > > Prelude> let x = 1 + 2 :: Int > Prelude> let z = (x,x) > > Prelude> :sprint z > z = (_,_) > > > So, 'z' has been evaluated to WHNF. > I was expecting to get: > > Prelude> :sprint z > z = _ > > > Meaning, an unevaluated expression. Just like we did with 'x', but it > seems z has already been partially evaluated. Am I getting this right? Are > expressions with constructors evaluated differently? Why is :sprint z > different from 'z = _' in this case? > > > Thanks again, > > > Dimitri > > > On 20/10/14 13:21, Bob Ippolito wrote: > > > > On Mon, Oct 20, 2014 at 11:57 AM, Dimitri DeFigueiredo < > defigueiredo at ucdavis.edu> wrote: > >> I found an interesting situation while making recursive calls that I am >> trying to understand. I re-wrote the 'minimum' function from the prelude as >> such: >> >> minimum_bug :: (Ord a) => [a] -> a >> minimum_bug [x] = x >> minimum_bug (x:xs) | x > minimum_bug xs = minimum_bug xs >> | otherwise = x >> >> (I understand I should be using something like "minbug xs = foldr1 min >> xs" for this, but bare with me) >> >> The interesting thing is that the function has exponential time behavior. >> In a way, that makes sense as I am making two recursive calls. But I was >> expecting GHC to be smart enough to transform it into something like: >> >> minimum_bug' :: (Ord a) => [a] -> a >> minimum_bug' [x] = x >> minimum_bug' (x:xs) | x > y = y >> | otherwise = x >> where y = minimum_bug' xs >> >> (This one always works as expected) >> >> I understand that lazy evaluation implies memoization in some cases. >> When does GHC only use memoization to avoid this kind of behavior? >> > > I assume you're trying this with ghci or compiling without > optimizations. In these scenarios GHC isn't doing anything clever at all, > so there will be two separate calls to minimum_bug in each recursion. Using > a variable ensures that this value is explicitly shared between the guard > and the result in the list. > > This section of Parallel and Concurrent Programming in Haskell helped me > understand Haskell's non-strict evaluation model: > http://chimera.labs.oreilly.com/books/1230000000929/ch02.html#sec_par-eval-whnf > > Another interesting fact is that in my simple tests the exponential >> behavior does NOT occur when I pass the function a list in sorted order. >> >> main = do putStrLn "started - in order list" >> putStrLn $ show $ minimum_bug [1..30000] -- no problem >> putStrLn "started - out of order list" >> putStrLn $ show $ minimum_bug [27,26..1] -- don't do this with >> large numbers! >> putStrLn "done!" >> >> It's not clear to me how the sorted list is able to escape the >> exponential slow down. >> > > Because displaying the value doesn't have any recursion to it, since > it's `x` and not `minumum_bug x`. > > You can walk through the execution. > > -- Original call > minimum_bug [1, 2] > -- Expand the first matching pattern > minimum_bug (1:[2]) | 1 > minimum_bug [2] > -- minimum_bug [2] is forced due to the guard > -- Evaluate minimum_bug [2] > minimum_bug [2] > -> 2 > -- Step back to the guard we were trying to evaluate > minimum_bug (1:[2]) | 1 > 2 > 1 > 2 > -> False > -- Guard fails, go to the otherwise case > | otherwise = 1 > -> 1 > > The `1` is already in normal form, so `putStrLn . show` doesn't have to > do any extra reductions. > > If you walk through with `minimum_bug [2, 1]` you'll end up with > `minimum_bug [1]` as the result, which is not in normal form and thus > requires additional evaluation when `putStrLn . show` attempts to display > it. If you use a larger list and walk through, you can see that the amount > of redundant evaluation explodes when the list is in descending order. > > -bob > > > > > _______________________________________________ > Beginners mailing listBeginners at haskell.orghttp://www.haskell.org/mailman/listinfo/beginners > > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From xged90 at gmail.com Fri Oct 24 13:30:36 2014 From: xged90 at gmail.com (Julius Gedvilas) Date: Fri, 24 Oct 2014 16:30:36 +0300 Subject: [Haskell-beginners] GHCi error msgs Message-ID: How difficult would it be to change format of GHCi compile-time error-messages of type "couldn't match expected type"? -------------- next part -------------- An HTML attachment was scrubbed... URL: From karolis.velicka at gmail.com Fri Oct 24 15:56:35 2014 From: karolis.velicka at gmail.com (Karolis Velicka) Date: Fri, 24 Oct 2014 16:56:35 +0100 Subject: [Haskell-beginners] GHCi error msgs In-Reply-To: References: Message-ID: What do you mean by that? Can you give an example? Best wishes, Karl (Karolis) Velicka On 24 October 2014 14:30, Julius Gedvilas wrote: > How difficult would it be to change format of GHCi compile-time > error-messages of type "couldn't match expected type"? > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > From xged90 at gmail.com Fri Oct 24 16:10:59 2014 From: xged90 at gmail.com (Julius Gedvilas) Date: Fri, 24 Oct 2014 19:10:59 +0300 Subject: [Haskell-beginners] GHCi error msgs In-Reply-To: References: Message-ID: You load a *.hs file into ghci (cabal repl) and, if types does not add up, you get an error message in form of "*.hs:line:col: Couldn't match expected type with actual type ...". I may like to reformat that message with Parsec. On Fri, Oct 24, 2014 at 6:56 PM, Karolis Velicka wrote: > What do you mean by that? Can you give an example? > > Best wishes, > Karl (Karolis) Velicka > > > On 24 October 2014 14:30, Julius Gedvilas wrote: > > How difficult would it be to change format of GHCi compile-time > > error-messages of type "couldn't match expected type"? > > > > _______________________________________________ > > Beginners mailing list > > Beginners at haskell.org > > http://www.haskell.org/mailman/listinfo/beginners > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rohits79 at gmail.com Sat Oct 25 03:31:01 2014 From: rohits79 at gmail.com (Rohit Sharma) Date: Sat, 25 Oct 2014 11:31:01 +0800 Subject: [Haskell-beginners] Question on syntax Message-ID: All, I started learning haskell very recently and have a question on the pattern matching style for lists. In the below snippet i.e. "(x:xs)" why do we went with round braces and not square? I know we are using cons that tells this is not a tuple but would it not make more sense to write something like [x:xs] instead of (x:xs), i thought round braces was used for pair/tuples? safeHead [] = Nothing safeHead (x:xs) = Just x Thanks, Rohit -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob at redivi.com Sat Oct 25 03:41:11 2014 From: bob at redivi.com (Bob Ippolito) Date: Fri, 24 Oct 2014 20:41:11 -0700 Subject: [Haskell-beginners] Question on syntax In-Reply-To: References: Message-ID: Round braces are used for grouping, it's necessary to avoid ambiguity since a function can be defined with more than one argument. When using case you don't have this potential ambiguity, so don't need the parentheses. Tuples are more of a special case in the grammar that isn't closely related to this. safeHead p = case p of [] -> Nothing x : xs -> Just x On Friday, October 24, 2014, Rohit Sharma wrote: > All, > > I started learning haskell very recently and have a question on the > pattern matching style for lists. > > In the below snippet i.e. "(x:xs)" why do we went with round braces and > not square? I know we are using cons that tells this is not a tuple but > would it not make more sense to write something like [x:xs] instead of > (x:xs), i thought round braces was used for pair/tuples? > > safeHead [] = Nothing > safeHead (x:xs) = Just x > > Thanks, > Rohit > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rustompmody at gmail.com Sat Oct 25 04:05:57 2014 From: rustompmody at gmail.com (Rustom Mody) Date: Sat, 25 Oct 2014 09:35:57 +0530 Subject: [Haskell-beginners] Question on syntax In-Reply-To: References: Message-ID: On Sat, Oct 25, 2014 at 9:01 AM, Rohit Sharma wrote: > All, > > I started learning haskell very recently and have a question on the > pattern matching style for lists. > > In the below snippet i.e. "(x:xs)" why do we went with round braces and > not square? I know we are using cons that tells this is not a tuple but > would it not make more sense to write something like [x:xs] instead of > (x:xs), i thought round braces was used for pair/tuples? > > safeHead [] = Nothing > safeHead (x:xs) = Just x > > Yes this can be confusing. Lets break it into two separate questions: 1. Why [] is not used around x:xs 2. Why () is used To address 1 start ghci and try out these expressions 1: [2,3] [1:[2,3]] To address 2 try out length [1,2] ++ [3,4] and then length ([1,2] ++ [3,4]) Another related example sin pi/2 and sin (pi/2) -------------- next part -------------- An HTML attachment was scrubbed... URL: From christian.sperandio at gmail.com Sat Oct 25 12:07:06 2014 From: christian.sperandio at gmail.com (Christian Sperandio) Date: Sat, 25 Oct 2014 14:07:06 +0200 Subject: [Haskell-beginners] Use mysql-simple (OS X and dymanic library trouble) Message-ID: Hi, I?d like to use Haskell for some processing on a MySQL database. Currently, I use Java program to do that but I?d like to change.And an important information, I?m working on OS X Maverick and I use EclipseFP. I installed mysql-simple package. I had some troubles. First, I had to download pcre to get a pcre.h I put into the /usr/include dir. After, to link the mysql-simple package I did an export LD_LIBRARY_PATH=/usr/local/mysql-5.6.11-osx10.7-x86_64/lib. Thus, the library libmysqlclient.18.dylib was found. All stuff above were done by command line. Now, I want to code a simple program: module Main where import Database.MySQL.Simple main::IO() main = undefined hello :: IO Int hello = do conn <- connect defaultConnectInfo [Only i] <- query_ conn "select 2 + 2" return i But when I try to launch a repl from EclipseFP, I?ve got this error: Loading package mysql-0.1.1.7 ... : can't load .so/.DLL for: /Users/batman/Library/Haskell/ghc-7.8.3-x86_64/lib/mysql-0.1.1.7/libHSmysql-0.1.1.7-ghc7.8.3.dylib (dlopen(/Users/batman/Library/Haskell/ghc-7.8.3-x86_64/lib/mysql-0.1.1.7/libHSmysql-0.1.1.7-ghc7.8.3.dylib, 9): Library not loaded: libmysqlclient.18.dylib Referenced from: /Users/batman/Library/Haskell/ghc-7.8.3-x86_64/lib/mysql-0.1.1.7/libHSmysql-0.1.1.7-ghc7.8.3.dylib Reason: image not found) How can I set the place of this library ? I read some stuff on the web but I don?t understand everything :( Thanks for your help. Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Sat Oct 25 13:43:12 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Sat, 25 Oct 2014 09:43:12 -0400 Subject: [Haskell-beginners] Use mysql-simple (OS X and dymanic library trouble) In-Reply-To: References: Message-ID: On Sat, Oct 25, 2014 at 8:07 AM, Christian Sperandio < christian.sperandio at gmail.com> wrote: > After, to link the mysql-simple package I did an export > LD_LIBRARY_PATH=/usr/local/mysql-5.6.11-osx10.7-x86_64/lib. Thus, the > library libmysqlclient.18.dylib was found. > This is usually a bad idea, and what you're seeing is the least of the things that can go wrong. The correct fix for all of this is not to use the environment settings, but to build the mysql binding with cabal install mysql-simple --extra-lib-dirs=/usr/local/mysql-5.6.11-osx10.7-x86_64/lib so it actually finds and records the location of the library instead of using an unsafe override that you have to reproduce at runtime (doing that for anything launched from the GUI is difficult, and in some OS X releases impossible, and is always risky). -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From christian.sperandio at gmail.com Sat Oct 25 15:09:41 2014 From: christian.sperandio at gmail.com (Christian Sperandio) Date: Sat, 25 Oct 2014 17:09:41 +0200 Subject: [Haskell-beginners] Use mysql-simple (OS X and dymanic library trouble) In-Reply-To: References: Message-ID: <902BB77D-09F8-49B9-A189-9B6D6E9AB4C7@gmail.com> I tried your solution but it doesn?t work. I unregistered the previous install with ghc-pkg unregister (for mysql and mysql-simple) and I tried: cabal install mysql --extra-lib-dirs=/usr/local/mysql-5.6.11-osx10.7-x86_64/lib But I get the error again: Resolving dependencies... Configuring mysql-0.1.1.7... Building mysql-0.1.1.7... Failed to install mysql-0.1.1.7 Last 10 lines of the build log ( /Users/batman/.cabal/logs/mysql-0.1.1.7.log ): Building mysql-0.1.1.7... Preprocessing library mysql-0.1.1.7... dyld: Library not loaded: libmysqlclient.18.dylib Referenced from: /private/var/folders/fk/339860r16j759wmsfmjkyr4h0000gn/T/mysql-0.1.1.7-25273/mysql-0.1.1.7/dist/build/Database/MySQL/Base/C_hsc_make Reason: image not found running dist/build/Database/MySQL/Base/C_hsc_make failed (exit code -5) command was: dist/build/Database/MySQL/Base/C_hsc_make >dist/build/Database/MySQL/Base/C.hs cabal: Error: some packages failed to install: mysql-0.1.1.7 failed during the building phase. The exception was: ExitFailure 1 Le 25 oct. 2014 ? 15:43, Brandon Allbery a ?crit : > On Sat, Oct 25, 2014 at 8:07 AM, Christian Sperandio wrote: > After, to link the mysql-simple package I did an export LD_LIBRARY_PATH=/usr/local/mysql-5.6.11-osx10.7-x86_64/lib. Thus, the library libmysqlclient.18.dylib was found. > > This is usually a bad idea, and what you're seeing is the least of the things that can go wrong. > > The correct fix for all of this is not to use the environment settings, but to build the mysql binding with > > cabal install mysql-simple --extra-lib-dirs=/usr/local/mysql-5.6.11-osx10.7-x86_64/lib > > so it actually finds and records the location of the library instead of using an unsafe override that you have to reproduce at runtime (doing that for anything launched from the GUI is difficult, and in some OS X releases impossible, and is always risky). > > -- > brandon s allbery kf8nh sine nomine associates > allbery.b at gmail.com ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Sat Oct 25 15:14:16 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Sat, 25 Oct 2014 11:14:16 -0400 Subject: [Haskell-beginners] Use mysql-simple (OS X and dymanic library trouble) In-Reply-To: <902BB77D-09F8-49B9-A189-9B6D6E9AB4C7@gmail.com> References: <902BB77D-09F8-49B9-A189-9B6D6E9AB4C7@gmail.com> Message-ID: On Sat, Oct 25, 2014 at 11:09 AM, Christian Sperandio < christian.sperandio at gmail.com> wrote: > I unregistered the previous install with ghc-pkg unregister (for mysql and > mysql-simple) and I tried: > cabal install mysql > --extra-lib-dirs=/usr/local/mysql-5.6.11-osx10.7-x86_64/lib > > But I get the error again: > Then I presume whoever wrote those bindings didn't follow the rules, and you'll have to contact them to find out how to get it to work properly. (Unfortunately there's a decent chance they made it work on Linux and don't know about other platforms, and their only suggestion will be the LD_LIBRARY_PATH one which will not work properly on OS X, as you found.) -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From christian.sperandio at gmail.com Sat Oct 25 15:16:47 2014 From: christian.sperandio at gmail.com (Christian Sperandio) Date: Sat, 25 Oct 2014 17:16:47 +0200 Subject: [Haskell-beginners] Use mysql-simple (OS X and dymanic library trouble) In-Reply-To: References: <902BB77D-09F8-49B9-A189-9B6D6E9AB4C7@gmail.com> Message-ID: <813C0C13-1FBC-4424-8436-5435232EF444@gmail.com> I?ll email the maintainer of the package. Meanwhile, I have to do the ugly export DYLD_LIBRARY_PATH :/ Thanks for your help :) Le 25 oct. 2014 ? 17:14, Brandon Allbery a ?crit : > > On Sat, Oct 25, 2014 at 11:09 AM, Christian Sperandio wrote: > I unregistered the previous install with ghc-pkg unregister (for mysql and mysql-simple) and I tried: > cabal install mysql --extra-lib-dirs=/usr/local/mysql-5.6.11-osx10.7-x86_64/lib > > But I get the error again: > > Then I presume whoever wrote those bindings didn't follow the rules, and you'll have to contact them to find out how to get it to work properly. (Unfortunately there's a decent chance they made it work on Linux and don't know about other platforms, and their only suggestion will be the LD_LIBRARY_PATH one which will not work properly on OS X, as you found.) > > -- > brandon s allbery kf8nh sine nomine associates > allbery.b at gmail.com ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Sat Oct 25 15:20:51 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Sat, 25 Oct 2014 11:20:51 -0400 Subject: [Haskell-beginners] Use mysql-simple (OS X and dymanic library trouble) In-Reply-To: <813C0C13-1FBC-4424-8436-5435232EF444@gmail.com> References: <902BB77D-09F8-49B9-A189-9B6D6E9AB4C7@gmail.com> <813C0C13-1FBC-4424-8436-5435232EF444@gmail.com> Message-ID: On Sat, Oct 25, 2014 at 11:16 AM, Christian Sperandio < christian.sperandio at gmail.com> wrote: > Meanwhile, I have to do the ugly export DYLD_LIBRARY_PATH :/ > Actually, don't --- that actually stands a good chance of breaking things in bizarre ways. Use DYLD_FALLBACK_LIBRARY_PATH instead, it's less likely to cause weird breakage. The other problem is that Eclipse is generally launched from the GUI, and getting DYLD_FALLBACK_LIBRARY_PATH visible to the GUI is painful: you need to create ~/.launchd.conf and add something like setenv DYLD_FALLBACK_LIBRARY_PATH /usr/local/ mysql-5.6.11-osx10.7-x86_64/lib to it, then log out and back in so that the GUI is started with it. (This does stand a certain chance of making things go haywire, because you're really not supposed to set that --- but in this case I think you're stuck.) -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From christian.sperandio at gmail.com Sat Oct 25 15:22:29 2014 From: christian.sperandio at gmail.com (Christian Sperandio) Date: Sat, 25 Oct 2014 17:22:29 +0200 Subject: [Haskell-beginners] Use mysql-simple (OS X and dymanic library trouble) In-Reply-To: References: <902BB77D-09F8-49B9-A189-9B6D6E9AB4C7@gmail.com> <813C0C13-1FBC-4424-8436-5435232EF444@gmail.com> Message-ID: <1D639431-3A45-4B0B-ADE5-D821BC1489AD@gmail.com> Thanks for the trick :) The solution is perhaps to try another mysql library :/ Le 25 oct. 2014 ? 17:20, Brandon Allbery a ?crit : > On Sat, Oct 25, 2014 at 11:16 AM, Christian Sperandio wrote: > Meanwhile, I have to do the ugly export DYLD_LIBRARY_PATH :/ > > Actually, don't --- that actually stands a good chance of breaking things in bizarre ways. Use DYLD_FALLBACK_LIBRARY_PATH instead, it's less likely to cause weird breakage. > > The other problem is that Eclipse is generally launched from the GUI, and getting DYLD_FALLBACK_LIBRARY_PATH visible to the GUI is painful: you need to create ~/.launchd.conf and add something like > > setenv DYLD_FALLBACK_LIBRARY_PATH /usr/local/mysql-5.6.11-osx10.7-x86_64/lib > > to it, then log out and back in so that the GUI is started with it. (This does stand a certain chance of making things go haywire, because you're really not supposed to set that --- but in this case I think you're stuck.) > > -- > brandon s allbery kf8nh sine nomine associates > allbery.b at gmail.com ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Sat Oct 25 15:30:11 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Sat, 25 Oct 2014 11:30:11 -0400 Subject: [Haskell-beginners] Use mysql-simple (OS X and dymanic library trouble) In-Reply-To: <1D639431-3A45-4B0B-ADE5-D821BC1489AD@gmail.com> References: <902BB77D-09F8-49B9-A189-9B6D6E9AB4C7@gmail.com> <813C0C13-1FBC-4424-8436-5435232EF444@gmail.com> <1D639431-3A45-4B0B-ADE5-D821BC1489AD@gmail.com> Message-ID: On Sat, Oct 25, 2014 at 11:22 AM, Christian Sperandio < christian.sperandio at gmail.com> wrote: > Thanks for the trick :) > > The solution is perhaps to try another mysql library :/ > It's the nonstandard location that is the problem, really. The --extra-lib-dirs thing should have caused the special location to be used, but it relies on whoever wrote the bindings paying attention to extra-lib-dirs. On Linux, you have /etc/ld.so.conf as a list of directories to search for shared objects and LD_LIBRARY_PATH to add extra directories to it. On OS X, shared library paths are normally compiled into the things that use them and DYLD_LIBRARY_PATH overrides this completely (which means setting it can cause all programs to fail to find any shared libraries, oops!). DYLD_FALLBACK_LIBRARY_PATH is tried if it can't find the shared library at its normal location, which is risky but safer than DYLD_LIBRARY_PATH. If that shared object /Users/batman/Library/Haskell/ ghc-7.8.3-x86_64/lib/mysql-0.1.1.7/libHSmysql-0.1.1.7-ghc7.8.3.dylib was built with the right option (-headerpad_max_install_names, IIRC) then you may be able to use install_name_tool to fix the shared object path in it. You'll need to use otool -L to check what name is there and then install_name_tool to replace it. Alternately you can check with otool -L what pathname was stored in the mysql shared library itself and maybe fix that with install_name_tool. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffbrown.the at gmail.com Sat Oct 25 18:04:14 2014 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Sat, 25 Oct 2014 11:04:14 -0700 Subject: [Haskell-beginners] Installation problems Message-ID: Hi, In trying to install Tidal, following something that worked for someone else who was getting an error similar to one I got, I ran ghc-clang-wrapper . I believe it was after that that cabal install stopped working, and I lost a lot of libraries that used to exist, such as Sound.MIDI: GHCi, version 7.8.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> import Sound.MIDI : Could not find module ?Sound.MIDI? It is not a module in the current program, or in any known package. Prelude> When I try to reinstall a library that used to exist -- e.g. "hosc", below -- via cabal install, I now get a giant slew of failures. Any ideas? Many thanks, Jeff sh-3.2# cabal install hosc Resolving dependencies... In order, the following will be installed: binary-0.7.2.2 (new version) data-binary-ieee754-0.4.4 (reinstall) changes: base-4.7.0.1 added, binary-0.7.2.2 added network-2.6.0.2 (new package) text-1.2.0.0 (new package) blaze-builder-0.3.3.4 (reinstall) changes: base-4.7.0.1 added, bytestring-0.10.4.0 added, text-1.2.0.0 added hosc-0.15 (new version) Warning: Note that reinstalls are always dangerous. Continuing anyway... Downloading binary-0.7.2.2... Configuring network-2.6.0.2... Configuring text-1.2.0.0... Failed to install network-2.6.0.2 Build log ( /var/root/.cabal/logs/network-2.6.0.2.log ): Failed to install text-1.2.0.0 Build log ( /var/root/.cabal/logs/text-1.2.0.0.log ): Configuring binary-0.7.2.2... Failed to install binary-0.7.2.2 Build log ( /var/root/.cabal/logs/binary-0.7.2.2.log ): cabal: Error: some packages failed to install: binary-0.7.2.2 failed during the configure step. The exception was: user error (: cannot satisfy -package-id Cabal-1.20.0.2-b862897337f86101d0e1a35135984eff: Cabal-1.20.0.2-b862897337f86101d0e1a35135984eff is unusable due to missing or recursive dependencies: base-4.7.0.1-df210ede1eb79477fef5662549c32927 bytestring-0.10.4.0-4aa78c8ca7b6b65993eefc131f7d94fa containers-0.5.5.1-0d8db9193d3e3371e0142bcc8a4a0721 deepseq-1.3.0.2-8f63133c1b77f3b3190f04893cf340e4 directory-1.2.1.0-af5afa2b9b551d3fec1a32d6bfd8bd72 process-1.2.0.0-3a472e9c66165e506513ea8f145681a0 time-1.4.2-d6766dce59812a4b19375d9595549a8b unix-2.7.0.1-8adde3f1f2079286da56b30898c2d703 (use -v for more information) ) blaze-builder-0.3.3.4 depends on text-1.2.0.0 which failed to install. data-binary-ieee754-0.4.4 depends on binary-0.7.2.2 which failed to install. hosc-0.15 depends on binary-0.7.2.2 which failed to install. network-2.6.0.2 failed during the configure step. The exception was: user error (: cannot satisfy -package-id Cabal-1.20.0.2-b862897337f86101d0e1a35135984eff: Cabal-1.20.0.2-b862897337f86101d0e1a35135984eff is unusable due to missing or recursive dependencies: base-4.7.0.1-df210ede1eb79477fef5662549c32927 bytestring-0.10.4.0-4aa78c8ca7b6b65993eefc131f7d94fa containers-0.5.5.1-0d8db9193d3e3371e0142bcc8a4a0721 deepseq-1.3.0.2-8f63133c1b77f3b3190f04893cf340e4 directory-1.2.1.0-af5afa2b9b551d3fec1a32d6bfd8bd72 process-1.2.0.0-3a472e9c66165e506513ea8f145681a0 time-1.4.2-d6766dce59812a4b19375d9595549a8b unix-2.7.0.1-8adde3f1f2079286da56b30898c2d703 (use -v for more information) ) text-1.2.0.0 failed during the configure step. The exception was: user error (: cannot satisfy -package-id Cabal-1.20.0.2-b862897337f86101d0e1a35135984eff: Cabal-1.20.0.2-b862897337f86101d0e1a35135984eff is unusable due to missing or recursive dependencies: base-4.7.0.1-df210ede1eb79477fef5662549c32927 bytestring-0.10.4.0-4aa78c8ca7b6b65993eefc131f7d94fa containers-0.5.5.1-0d8db9193d3e3371e0142bcc8a4a0721 deepseq-1.3.0.2-8f63133c1b77f3b3190f04893cf340e4 directory-1.2.1.0-af5afa2b9b551d3fec1a32d6bfd8bd72 process-1.2.0.0-3a472e9c66165e506513ea8f145681a0 time-1.4.2-d6766dce59812a4b19375d9595549a8b unix-2.7.0.1-8adde3f1f2079286da56b30898c2d703 (use -v for more information) ) -------------- next part -------------- An HTML attachment was scrubbed... URL: From objitsu at gmail.com Sun Oct 26 08:28:51 2014 From: objitsu at gmail.com (emacstheviking) Date: Sun, 26 Oct 2014 08:28:51 +0000 Subject: [Haskell-beginners] Use mysql-simple (OS X and dymanic library trouble) In-Reply-To: References: <902BB77D-09F8-49B9-A189-9B6D6E9AB4C7@gmail.com> <813C0C13-1FBC-4424-8436-5435232EF444@gmail.com> <1D639431-3A45-4B0B-ADE5-D821BC1489AD@gmail.com> Message-ID: Didn't somebody produce a 100% Haskell mysql client a while back? On 25 October 2014 16:30, Brandon Allbery wrote: > On Sat, Oct 25, 2014 at 11:22 AM, Christian Sperandio < > christian.sperandio at gmail.com> wrote: > >> Thanks for the trick :) >> >> The solution is perhaps to try another mysql library :/ >> > > It's the nonstandard location that is the problem, really. The > --extra-lib-dirs thing should have caused the special location to be used, > but it relies on whoever wrote the bindings paying attention to > extra-lib-dirs. > > On Linux, you have /etc/ld.so.conf as a list of directories to search for > shared objects and LD_LIBRARY_PATH to add extra directories to it. On OS X, > shared library paths are normally compiled into the things that use them > and DYLD_LIBRARY_PATH overrides this completely (which means setting it can > cause all programs to fail to find any shared libraries, oops!). > DYLD_FALLBACK_LIBRARY_PATH is tried if it can't find the shared library at > its normal location, which is risky but safer than DYLD_LIBRARY_PATH. > > If that shared object /Users/batman/Library/Haskell/ > ghc-7.8.3-x86_64/lib/mysql-0.1.1.7/libHSmysql-0.1.1.7-ghc7.8.3.dylib was > built with the right option (-headerpad_max_install_names, IIRC) then you > may be able to use install_name_tool to fix the shared object path in it. > You'll need to use otool -L to check what name is there and then > install_name_tool to replace it. > > Alternately you can check with otool -L what pathname was stored in the > mysql shared library itself and maybe fix that with install_name_tool. > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.snajder at fer.hr Sun Oct 26 21:34:44 2014 From: jan.snajder at fer.hr (Jan Snajder) Date: Sun, 26 Oct 2014 22:34:44 +0100 Subject: [Haskell-beginners] Lazy state + IO not lazy? Message-ID: <544D68F4.5080707@fer.hr> Dear Haskellers, I'm confused with the behaviour of a lazy state monad when combined with an IO monad. Look at this: ghci> Control.Monad.State.Lazy.evalState (head `fmap` mapM return (1:undefined)) 0 1 ghci> Control.Monad.State.Lazy.evalStateT (head `fmap` mapM return (1:undefined)) 0 *** Exception: Prelude.undefined I would have expected the second case to behave identically to the first case. Why is this not the case? Cheers, Jan From cui.liqiang at gmail.com Sun Oct 26 22:52:08 2014 From: cui.liqiang at gmail.com (Cui Liqiang) Date: Mon, 27 Oct 2014 06:52:08 +0800 Subject: [Haskell-beginners] Haskell typing question Message-ID: <58B82D7F9B3A481AB619C44EA71E2FE5@gmail.com> Hi, I am doing an exercise in Haskell, which is converting a string like ?$123.312? to double value. Below is my code: module Main where import Data.Char caluInt l = foldl1 (\acc x -> acc * 10 + x) (map digitToInt l) caluDecimal l = (foldr1 (\x acc -> acc / 10.0 + x) (map digitToInt l)) convert(x:xs) = let num = [e | e <- xs, e /= ','] intPart = takeWhile (/='.') num decimalPart = tail(dropWhile (/='.') num) in (caluInt intPart) + (caluDecimal decimalPart) And I got an error in this line: caluDecimal l = (foldr1 (\x acc -> acc / 10.0 + x) (map digitToInt l)), which says: No instance for (Fractional Int) arising from a use of `/' Possible fix: add an instance declaration for (Fractional Int) In the first argument of `(+)', namely `acc / 10.0' In the expression: acc / 10.0 + x In the first argument of `foldr1', namely `(\ x acc -> acc / 10.0 + x)' Why Haskell insists that 10.0 is a Int? How can I explicitly tell Haskell I want a Fractional? -- Cui Liqiang -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Sun Oct 26 22:51:16 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 26 Oct 2014 18:51:16 -0400 Subject: [Haskell-beginners] Haskell typing question In-Reply-To: <58B82D7F9B3A481AB619C44EA71E2FE5@gmail.com> References: <58B82D7F9B3A481AB619C44EA71E2FE5@gmail.com> Message-ID: On Sun, Oct 26, 2014 at 6:52 PM, Cui Liqiang wrote: > Why Haskell insists that 10.0 is a Int? How can I explicitly tell Haskell > I want a Fractional? > Because digitToInt means exactly what it says. If you want it to become something other than Int, apply fromIntegral to its result. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From ky3 at atamo.com Mon Oct 27 06:08:09 2014 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Mon, 27 Oct 2014 13:08:09 +0700 Subject: [Haskell-beginners] Lazy state + IO not lazy? In-Reply-To: <544D68F4.5080707@fer.hr> References: <544D68F4.5080707@fer.hr> Message-ID: Better to drill into the heart of the question and put aside state transformers for now. Consider let u = return () :: IO () in expr >> u where expr ranges over (return undefined), (undefined), and (error "urk"). Are their executions surprising? Compare to let u = return () :: State Int () in evalState (expr >> u) 0 for both strict and lazy state. IO above matches one of them. Suppose IO's behavior matches the other, what happens? Now with the definition of mapM in mind, consider the difference between your original: Lazy.evalStateT (head `fmap` mapM return (1:undefined)) 0 and Lazy.evalStateT (head `fmap` mapM return [1,undefined]) 0 Did you mean the latter? -- Kim-Ee On 10/27/14, Jan Snajder wrote: > Dear Haskellers, > > I'm confused with the behaviour of a lazy state monad when combined with > an IO monad. Look at this: > > ghci> Control.Monad.State.Lazy.evalState (head `fmap` mapM return > (1:undefined)) 0 > 1 > > ghci> Control.Monad.State.Lazy.evalStateT (head `fmap` mapM return > (1:undefined)) 0 > *** Exception: Prelude.undefined > > I would have expected the second case to behave identically to the first > case. Why is this not the case? > > Cheers, > Jan > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > -- -- Kim-Ee From ovidiudeac at gmail.com Mon Oct 27 20:47:19 2014 From: ovidiudeac at gmail.com (Ovidiu Deac) Date: Mon, 27 Oct 2014 22:47:19 +0200 Subject: [Haskell-beginners] can somebody explain the type of this expression? Message-ID: Prelude> let f x = x * 2 Prelude> :t f f :: Num a => a -> a The typeclass Num is defined like this: class Num a where (+), (-), (*) :: a -> a -> a ... ...which means that the operator (*) expects two parameters of type a and returns a value of type a. Since the definition of expr looks like this: Prelude> let f x = x * 2 ...and 2 is an Int, I would expect that the type inferred for (*) is (Int -> Int -> Int) and thus f should be (Int -> Int) Can somebody explain this? Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Mon Oct 27 20:54:20 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Mon, 27 Oct 2014 16:54:20 -0400 Subject: [Haskell-beginners] can somebody explain the type of this expression? In-Reply-To: References: Message-ID: On Mon, Oct 27, 2014 at 4:47 PM, Ovidiu Deac wrote: > Since the definition of expr looks like this: > Prelude> let f x = x * 2 > > ...and 2 is an Int, I would expect that the type inferred for (*) is (Int > -> Int -> Int) and thus f should be (Int -> Int) > Prelude> :t 2 2 :: Num a => a Numeric literals are polymorphic. http://www.haskell.org/onlinereport/haskell2010/haskellch6.html#x13-1360006.4.1 is the official specification of this. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From mwm at mired.org Mon Oct 27 20:54:07 2014 From: mwm at mired.org (Mike Meyer) Date: Mon, 27 Oct 2014 15:54:07 -0500 Subject: [Haskell-beginners] can somebody explain the type of this expression? In-Reply-To: References: Message-ID: On Mon, Oct 27, 2014 at 3:47 PM, Ovidiu Deac wrote: > Prelude> let f x = x * 2 > Prelude> :t f > f :: Num a => a -> a > > The typeclass Num is defined like this: > > class Num a where > (+), (-), (*) :: a -> a -> a > ... > > ...which means that the operator (*) expects two parameters of type a and > returns a value of type a. > > Since the definition of expr looks like this: > Prelude> let f x = x * 2 > > ...and 2 is an Int, I would expect that the type inferred for (*) is (Int > -> Int -> Int) and thus f should be (Int -> Int) > > Can somebody explain this? > > Thanks! > Not sure of the terminology, but 2 can be coerced to any different type of Num, so that it can be used in non-Int expressions: 2 / 3 0.6666666666666666 Prelude> :t 2 / 3 2 / 3 :: Fractional a => a Prelude> :t 2 2 :: Num a => a Note that Fractional is also a type class, not a type like Int, so Floating types do the same thing. For that mater, if you enabled OverloadedStrings, you can get that behavior out of strings: Prelude> :t "abc" "abc" :: [Char] Prelude> :set -XOverloadedStrings Prelude> :t "abc" "abc" :: Data.String.IsString a => a -------------- next part -------------- An HTML attachment was scrubbed... URL: From ovidiudeac at gmail.com Mon Oct 27 21:02:02 2014 From: ovidiudeac at gmail.com (Ovidiu Deac) Date: Mon, 27 Oct 2014 23:02:02 +0200 Subject: [Haskell-beginners] can somebody explain the type of this expression? In-Reply-To: References: Message-ID: Makes sense. Thanks! On Mon, Oct 27, 2014 at 10:54 PM, Brandon Allbery wrote: > On Mon, Oct 27, 2014 at 4:47 PM, Ovidiu Deac wrote: > >> Since the definition of expr looks like this: >> Prelude> let f x = x * 2 >> >> ...and 2 is an Int, I would expect that the type inferred for (*) is >> (Int -> Int -> Int) and thus f should be (Int -> Int) >> > > Prelude> :t 2 > 2 :: Num a => a > > Numeric literals are polymorphic. > http://www.haskell.org/onlinereport/haskell2010/haskellch6.html#x13-1360006.4.1 > is the official specification of this. > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From slackmoehrle at gmail.com Tue Oct 28 03:11:12 2014 From: slackmoehrle at gmail.com (Jason T. Slack-Moehrle) Date: Mon, 27 Oct 2014 20:11:12 -0700 Subject: [Haskell-beginners] error compiling haskell-src-1.0.1.4 Message-ID: I am trying to compile haskell-platform on an AWS instance. The version: haskell-platform-2011.2.0.0 It was going OK, but now I am getting an error I dont know how to solve: Building haskell-src-1.0.1.4... [1 of 6] Compiling Language.Haskell.Syntax ( Language/Haskell/Syntax.hs, dist/build/Language/Haskell/Syntax.o ) [2 of 6] Compiling Language.Haskell.Pretty ( Language/Haskell/Pretty.hs, dist/build/Language/Haskell/Pretty.o ) [3 of 6] Compiling Language.Haskell.ParseMonad ( Language/Haskell/ParseMonad.hs, dist/build/Language/Haskell/ParseMonad.o ) [4 of 6] Compiling Language.Haskell.ParseUtils ( Language/Haskell/ParseUtils.hs, dist/build/Language/Haskell/ParseUtils.o ) [5 of 6] Compiling Language.Haskell.Lexer ( Language/Haskell/Lexer.hs, dist/build/Language/Haskell/Lexer.o ) [6 of 6] Compiling Language.Haskell.Parser ( dist/build/Language/Haskell/Parser.hs, dist/build/Language/Haskell/Parser.o ) dist/build/Language/Haskell/Parser.hs:0:36: The function `runParserWithMode' is applied to 8 arguments, but its type `ParseMode -> P a0 -> String -> ParseResult a0' has only three In the expression: runParserWithMode mode parse 1 3 4 3 4 2 In an equation for `parseModuleWithMode': parseModuleWithMode mode = runParserWithMode mode parse 1 3 4 3 4 2 Error: Building the haskell-src-1.0.1.4 package failed make: *** [build.stamp] Error 2 Can anyone help me get past this? Best, Jason -------------- next part -------------- An HTML attachment was scrubbed... URL: From efasckenoth at gmail.com Tue Oct 28 04:49:21 2014 From: efasckenoth at gmail.com (Stefan =?iso-8859-1?Q?H=F6ck?=) Date: Tue, 28 Oct 2014 05:49:21 +0100 Subject: [Haskell-beginners] Cabal-install of local package Message-ID: <20141028044921.GA11296@hunter> Dear list Like many other I seem to be struggling with some of the concepts of cabal and cabal-install. For the records: I use cabal-install 1.20.0.3 and ghc 7.8.3 on arch linux. For starters, I implemented my own idea of an improved prelude, called the package efa-prelude and the module it exports Efa.Prelude. I then built the package and installed it using `cabal install --user`. This worked and a folder for the library was created at "$HOME/.cabal/lib/x86_64-linux-ghc-7.8.3/efa-prelude-0.1.0". I also registered the library using `cabal register --user` and now cabal prints some information about the package when I type `cabal info efa-prelude`. I am also able to import Efa.Prelude into ghci. However, when I now try to use this library in another local project using a sandbox this time, I can build the project but when I try to install it into the sandbox I get the following error message: Resolving dependencies... cabal: Could not resolve dependencies: trying: test-0.1.0 (user goal) next goal: efa-prelude (dependency of test-0.1.0) Dependency tree exhaustively searched. I just tried and the install works if I do it outside of a sandbox. Obviously I am missing something crucial here. Could somebody please point me in the right direction what is needed to make my own packages available in a sanboxed install? Thanks for your time Stefan From efasckenoth at gmail.com Tue Oct 28 05:22:03 2014 From: efasckenoth at gmail.com (Stefan =?iso-8859-1?Q?H=F6ck?=) Date: Tue, 28 Oct 2014 06:22:03 +0100 Subject: [Haskell-beginners] Cabal-install of local package In-Reply-To: <20141028044921.GA11296@hunter> References: <20141028044921.GA11296@hunter> Message-ID: <20141028052203.GB11296@hunter> So, I think I figured this out myself after some more googling: `cabal sandbox add-source /path/to/efa-prelude` did the trick as explained here: http://coldwa.st/e/blog/2013-08-20-Cabal-sandbox.html Please excuse the noise. Move on. On Tue, Oct 28, 2014 at 05:49:21AM +0100, Stefan H?ck wrote: > Dear list > > Like many other I seem to be struggling with some of the concepts of > cabal and cabal-install. For the records: I use cabal-install 1.20.0.3 > and ghc 7.8.3 on arch linux. > > For starters, I implemented my own idea of an improved prelude, called > the package efa-prelude and the module it exports Efa.Prelude. I then > built the package and installed it using `cabal install --user`. > This worked and a folder for the library was created at > "$HOME/.cabal/lib/x86_64-linux-ghc-7.8.3/efa-prelude-0.1.0". > I also registered the library using `cabal register --user` and > now cabal prints some information about the package when I type > `cabal info efa-prelude`. I am also able to import Efa.Prelude into > ghci. > > However, when I now try to use this library in another local project > using a sandbox this time, I can build the project but > when I try to install it into the sandbox I get the following error > message: > > Resolving dependencies... > cabal: Could not resolve dependencies: > trying: test-0.1.0 (user goal) > next goal: efa-prelude (dependency of test-0.1.0) > Dependency tree exhaustively searched. > > I just tried and the install works if I do it outside of a sandbox. > Obviously I am missing something crucial here. Could somebody please point me > in the right direction what is needed to make my own packages available > in a sanboxed install? > > Thanks for your time > > Stefan > From cui.liqiang at gmail.com Tue Oct 28 12:00:29 2014 From: cui.liqiang at gmail.com (Cui Liqiang) Date: Tue, 28 Oct 2014 20:00:29 +0800 Subject: [Haskell-beginners] Haskell typing question In-Reply-To: References: Message-ID: <66B752EEB7C34B31B7E9E4149CE569AE@gmail.com> Thanks for your help, your suggestion works. But I still don?t quite understand. In the following line: caluDecimal l = (foldr1 (\x acc -> acc / 10.0 + x) (map digitToInt l)), After applying digitToInt, the type of ?x? in the expression above is Int indeed, but Haskell consider the ?10.0? to be a Int, is it? ---------------------------------------------------------------------------------------------------------------------------- Hi, I am doing an exercise in Haskell, which is converting a string like ?$123.312? to double value. Below is my code: module Main where import Data.Char caluInt l = foldl1 (\acc x -> acc * 10 + x) (map digitToInt l) caluDecimal l = (foldr1 (\x acc -> acc / 10.0 + x) (map digitToInt l)) convert(x:xs) = let num = [e | e <- xs, e /= ','] intPart = takeWhile (/='.') num decimalPart = tail(dropWhile (/='.') num) in (caluInt intPart) + (caluDecimal decimalPart) And I got an error in this line: caluDecimal l = (foldr1 (\x acc -> acc / 10.0 + x) (map digitToInt l)), which says: No instance for (Fractional Int) arising from a use of `/' Possible fix: add an instance declaration for (Fractional Int) In the first argument of `(+)', namely `acc / 10.0' In the expression: acc / 10.0 + x In the first argument of `foldr1', namely `(\ x acc -> acc / 10.0 + x)' Why Haskell insists that 10.0 is a Int? How can I explicitly tell Haskell I want a Fractional? -- Cui Liqiang > Why Haskell insists that 10.0 is a Int? How can I explicitly tell Haskell > I want a Fractional? Because digitToInt means exactly what it says. If you want it to become something other than Int, apply fromIntegral to its result. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cui.liqiang at gmail.com Tue Oct 28 12:08:34 2014 From: cui.liqiang at gmail.com (Cui Liqiang) Date: Tue, 28 Oct 2014 20:08:34 +0800 Subject: [Haskell-beginners] Haskell typing question In-Reply-To: <66B752EEB7C34B31B7E9E4149CE569AE@gmail.com> References: <66B752EEB7C34B31B7E9E4149CE569AE@gmail.com> Message-ID: <6EFC9BFE4FDA456E9BB906269849FBDD@gmail.com> I got it! The msg ? No instance for (Fractional Int) arising from a use of `/? ? actually has no business with the operands order at all ! -- Cui Liqiang On Tuesday, October 28, 2014 at 8:00 PM, Cui Liqiang wrote: > Thanks for your help, your suggestion works. > > But I still don?t quite understand. In the following line: > caluDecimal l = (foldr1 (\x acc -> acc / 10.0 + x) (map digitToInt l)), > After applying digitToInt, the type of ?x? in the expression above is Int indeed, but Haskell consider the ?10.0? to be a Int, is it? > > > > > ---------------------------------------------------------------------------------------------------------------------------- > Hi, > I am doing an exercise in Haskell, which is converting a string like ?$123.312? to double value. Below is my code: > > module Main where > import Data.Char > > caluInt l = foldl1 (\acc x -> acc * 10 + x) (map digitToInt l) > caluDecimal l = (foldr1 (\x acc -> acc / 10.0 + x) (map digitToInt l)) > > convert(x:xs) = > let num = [e | e <- xs, e /= ','] > intPart = takeWhile (/='.') num > decimalPart = tail(dropWhile (/='.') num) > in (caluInt intPart) + (caluDecimal decimalPart) > > > And I got an error in this line: caluDecimal l = (foldr1 (\x acc -> acc / 10.0 + x) (map digitToInt l)), > which says: > No instance for (Fractional Int) arising from a use of `/' > Possible fix: add an instance declaration for (Fractional Int) > In the first argument of `(+)', namely `acc / 10.0' > In the expression: acc / 10.0 + x > In the first argument of `foldr1', namely > `(\ x acc -> acc / 10.0 + x)' > > > Why Haskell insists that 10.0 is a Int? How can I explicitly tell Haskell I want a Fractional? > -- > Cui Liqiang > > > > > Why Haskell insists that 10.0 is a Int? How can I explicitly tell Haskell > > I want a Fractional? > > > > > Because digitToInt means exactly what it says. If you want it to become > something other than Int, apply fromIntegral to its result. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hjgtuyl at chello.nl Tue Oct 28 13:38:51 2014 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Tue, 28 Oct 2014 14:38:51 +0100 Subject: [Haskell-beginners] Haskell typing question In-Reply-To: <6EFC9BFE4FDA456E9BB906269849FBDD@gmail.com> References: <66B752EEB7C34B31B7E9E4149CE569AE@gmail.com> <6EFC9BFE4FDA456E9BB906269849FBDD@gmail.com> Message-ID: In the expression \x acc -> acc / 10.0 + x 10.0 is a Fractional number, / is an operator that works on types in the class Fractional, x is an Int, because the expression is applied to an Int. To get the types correct, use fromIntegral: caluDecimal l = (foldr1 (\x acc -> acc / 10.0 + x) (map (fromIntegral . digitToInt) l)) (note, that you can write 10 instead of 10.0, with the same result.) Regards, Henk-Jan van Tuyl On Tue, 28 Oct 2014 13:08:34 +0100, Cui Liqiang wrote: > I got it! > > The msg ? No instance for (Fractional Int) arising from a use of `/? ? > actually has no business with the operands order at all ! > > -- > Cui Liqiang > > > On Tuesday, October 28, 2014 at 8:00 PM, Cui Liqiang wrote: > >> Thanks for your help, your suggestion works. >> >> But I still don?t quite understand. In the following line: >> caluDecimal l = (foldr1 (\x acc -> acc / 10.0 + x) (map digitToInt l)), >> After applying digitToInt, the type of ?x? in the expression above is >> Int indeed, but Haskell consider the ?10.0? to be a Int, is it? >> >> >> >> >> ---------------------------------------------------------------------------------------------------------------------------- >> Hi, >> I am doing an exercise in Haskell, which is converting a string like >> ?$123.312? to double value. Below is my code: >> >> module Main where >> import Data.Char >> >> caluInt l = foldl1 (\acc x -> acc * 10 + x) (map digitToInt l) >> caluDecimal l = (foldr1 (\x acc -> acc / 10.0 + x) (map digitToInt l)) >> >> convert(x:xs) = >> let num = [e | e <- xs, e /= ','] >> intPart = takeWhile (/='.') num >> decimalPart = tail(dropWhile (/='.') num) >> in (caluInt intPart) + (caluDecimal decimalPart) >> >> >> And I got an error in this line: caluDecimal l = (foldr1 (\x acc -> acc >> / 10.0 + x) (map digitToInt l)), >> which says: >> No instance for (Fractional Int) arising from a use of `/' >> Possible fix: add an instance declaration for (Fractional Int) >> In the first argument of `(+)', namely `acc / 10.0' >> In the expression: acc / 10.0 + x >> In the first argument of `foldr1', namely >> `(\ x acc -> acc / 10.0 + x)' >> >> >> Why Haskell insists that 10.0 is a Int? How can I explicitly tell >> Haskell I want a Fractional? : >> Because digitToInt means exactly what it says. If you want it to become >> something other than Int, apply fromIntegral to its result. >> >> > > -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From jeffbrown.the at gmail.com Tue Oct 28 18:59:36 2014 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Tue, 28 Oct 2014 11:59:36 -0700 Subject: [Haskell-beginners] Installation problems In-Reply-To: References: Message-ID: Problem solved. I reinstalled Mac OS 10.9, retaining no programs or settings, just ordinary user-land files. Now everything works beautifully :) On Sat, Oct 25, 2014 at 11:04 AM, Jeffrey Brown wrote: > Hi, > > In trying to install Tidal, following something that worked for someone > else who was getting an error similar to one I got, I ran > ghc-clang-wrapper > . I believe > it was after that that cabal install stopped working, and I lost a lot of > libraries that used to exist, such as Sound.MIDI: > > GHCi, version 7.8.3: http://www.haskell.org/ghc/ :? for help > Loading package ghc-prim ... linking ... done. > Loading package integer-gmp ... linking ... done. > Loading package base ... linking ... done. > Prelude> import Sound.MIDI > > : > Could not find module ?Sound.MIDI? > It is not a module in the current program, or in any known package. > Prelude> > > When I try to reinstall a library that used to exist -- e.g. "hosc", below > -- via cabal install, I now get a giant slew of failures. > > Any ideas? > > Many thanks, > Jeff > > sh-3.2# cabal install hosc > Resolving dependencies... > In order, the following will be installed: > binary-0.7.2.2 (new version) > data-binary-ieee754-0.4.4 (reinstall) changes: base-4.7.0.1 added, > binary-0.7.2.2 added > network-2.6.0.2 (new package) > text-1.2.0.0 (new package) > blaze-builder-0.3.3.4 (reinstall) changes: base-4.7.0.1 added, > bytestring-0.10.4.0 added, text-1.2.0.0 added > hosc-0.15 (new version) > Warning: Note that reinstalls are always dangerous. Continuing > anyway... > Downloading binary-0.7.2.2... > Configuring network-2.6.0.2... > Configuring text-1.2.0.0... > Failed to install network-2.6.0.2 > Build log ( /var/root/.cabal/logs/network-2.6.0.2.log ): > Failed to install text-1.2.0.0 > Build log ( /var/root/.cabal/logs/text-1.2.0.0.log ): > Configuring binary-0.7.2.2... > Failed to install binary-0.7.2.2 > Build log ( /var/root/.cabal/logs/binary-0.7.2.2.log ): > cabal: Error: some packages failed to install: > binary-0.7.2.2 failed during the configure step. The exception was: > user error (: cannot satisfy -package-id > Cabal-1.20.0.2-b862897337f86101d0e1a35135984eff: > Cabal-1.20.0.2-b862897337f86101d0e1a35135984eff is unusable due to > missing or > recursive dependencies: > base-4.7.0.1-df210ede1eb79477fef5662549c32927 > bytestring-0.10.4.0-4aa78c8ca7b6b65993eefc131f7d94fa > containers-0.5.5.1-0d8db9193d3e3371e0142bcc8a4a0721 > deepseq-1.3.0.2-8f63133c1b77f3b3190f04893cf340e4 > directory-1.2.1.0-af5afa2b9b551d3fec1a32d6bfd8bd72 > process-1.2.0.0-3a472e9c66165e506513ea8f145681a0 > time-1.4.2-d6766dce59812a4b19375d9595549a8b > unix-2.7.0.1-8adde3f1f2079286da56b30898c2d703 > (use -v for more information) > ) > blaze-builder-0.3.3.4 depends on text-1.2.0.0 which failed to install. > data-binary-ieee754-0.4.4 depends on binary-0.7.2.2 which failed to > install. > hosc-0.15 depends on binary-0.7.2.2 which failed to install. > network-2.6.0.2 failed during the configure step. The exception was: > user error (: cannot satisfy -package-id > Cabal-1.20.0.2-b862897337f86101d0e1a35135984eff: > Cabal-1.20.0.2-b862897337f86101d0e1a35135984eff is unusable due to > missing or > recursive dependencies: > base-4.7.0.1-df210ede1eb79477fef5662549c32927 > bytestring-0.10.4.0-4aa78c8ca7b6b65993eefc131f7d94fa > containers-0.5.5.1-0d8db9193d3e3371e0142bcc8a4a0721 > deepseq-1.3.0.2-8f63133c1b77f3b3190f04893cf340e4 > directory-1.2.1.0-af5afa2b9b551d3fec1a32d6bfd8bd72 > process-1.2.0.0-3a472e9c66165e506513ea8f145681a0 > time-1.4.2-d6766dce59812a4b19375d9595549a8b > unix-2.7.0.1-8adde3f1f2079286da56b30898c2d703 > (use -v for more information) > ) > text-1.2.0.0 failed during the configure step. The exception was: > user error (: cannot satisfy -package-id > Cabal-1.20.0.2-b862897337f86101d0e1a35135984eff: > Cabal-1.20.0.2-b862897337f86101d0e1a35135984eff is unusable due to > missing or > recursive dependencies: > base-4.7.0.1-df210ede1eb79477fef5662549c32927 > bytestring-0.10.4.0-4aa78c8ca7b6b65993eefc131f7d94fa > containers-0.5.5.1-0d8db9193d3e3371e0142bcc8a4a0721 > deepseq-1.3.0.2-8f63133c1b77f3b3190f04893cf340e4 > directory-1.2.1.0-af5afa2b9b551d3fec1a32d6bfd8bd72 > process-1.2.0.0-3a472e9c66165e506513ea8f145681a0 > time-1.4.2-d6766dce59812a4b19375d9595549a8b > unix-2.7.0.1-8adde3f1f2079286da56b30898c2d703 > (use -v for more information) > ) > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alia_khouri at yahoo.com Thu Oct 2 19:34:18 2014 From: alia_khouri at yahoo.com (Alia) Date: Thu, 02 Oct 2014 19:34:18 -0000 Subject: [Haskell-beginners] abstracting parametrized record types Message-ID: <1043822803.108276.1412278273309.JavaMail.yahoo@jws10733.mail.gq1.yahoo.com> Hi Folks, Here's a problem that's frustrating me: I have defined a parametrized record type which looks like this: data Job a? = Job ??? { jobID?????????????? :: String ??? , jobName???????????? :: String ??? , jobTable??????????? :: String ??? , jobSource?????????? :: IO [a] ??? , jobProcessors?????? :: [a -> a] ??? } where a is a data model type that maps on to a database table, for example: data Person = Person ??? { name :: String ??? , age? :: Int ??? } deriving (Show) data Car = Car ??? { brand :: String ??? , value :: Double ??? , year? :: Int ??? } deriving (Show) I would like to define a higher-level record type which contains, for configuration purposes, a certain set of jobs for execution. Let's say we call it a JobSet and which could possibly look like this: data JobSet = JobSet ??? { jobsetID????????? :: String ??? , jobsetName??????? :: String ??? , jobs????????????? :: [Job]? <-- yes I know this is not legal ??? } Is there a legal haskell way to achieve the above objective without having to do something like this which hardcodes the model type into the jobset schema? data JobSet = JobSet ??? { jobsetID????????? :: String ??? , jobsetName??????? :: String ??? , personJobs??????? :: [Job Person] ??? , carJobs?????????? :: [Job Car] ??? } Many thanks for any enlightenment on this front. Alia -------------- next part -------------- An HTML attachment was scrubbed... URL: