From byorgey at seas.upenn.edu Sun Dec 1 03:21:27 2013 From: byorgey at seas.upenn.edu (Brent Yorgey) Date: Sat, 30 Nov 2013 22:21:27 -0500 Subject: [Haskell-beginners] Equality instance for lists In-Reply-To: <7410f2a45dd5.529a697b@dit.ie> References: <7410f2a45dd5.529a697b@dit.ie> Message-ID: <20131201032127.GA6944@seas.upenn.edu> On Sat, Nov 30, 2013 at 10:40:59PM +0000, Patrick Browne wrote: > Hi, > I am trying to write my own simplified class and instances for equality. > I have trouble with the equality equation for the empty list. > Even though I can use the [] == [] at the GHCi prompt I cannot use it in > my equality test. > How can I make my eq test handle empty lists while staying within the > context of my current code?. > Thanks, > Pat > > class Eq1 a where > eq :: a -> a -> Bool > > instance Eq1 Int where > eq a b = a == b > > instance Eq1 a => Eq1 [a] where > -- This line compiles but gives an run time error. > eq [] [] = True This code does not give a run time error. The error you are getting is a type inference error, which has nothing to do with this code. > eq [] [] You simply need to give a type annotation on one of the empty lists. eq ([] :: [Int]) [] The standard Eq class has some built-in magic support by GHCI (extended default rules) which means this does not apply in the case of using == directly. -Brent From willieekaputra at gmail.com Sun Dec 1 07:22:12 2013 From: willieekaputra at gmail.com (willie ekaputra) Date: Sun, 1 Dec 2013 08:22:12 +0100 Subject: [Haskell-beginners] This code does not work : conversion error Message-ID: Hi everyone ! I am newbie and I made this code for counting k, so that 2^k divisor of n.Somehow it doesn't work. Anyone knows what is wrong? Regards and thanks. Wili. maxexp2:: Int -> Int maxexp2 n |n== 0 || 2^k 'mod' n /=0 =0 |otherwise = k Where k= e ' div' f e=round (fromIntegral (log n)) f = round (fromIntegral (log 2)) -------------- next part -------------- An HTML attachment was scrubbed... URL: From toad3k at gmail.com Sun Dec 1 08:12:08 2013 From: toad3k at gmail.com (David McBride) Date: Sun, 1 Dec 2013 03:12:08 -0500 Subject: [Haskell-beginners] This code does not work : conversion error In-Reply-To: References: Message-ID: You just have a few problems. Where should be lowercase. The single quotes should be backticks "`". You may have some indentation issues. And lastly, you have some problems with e and f e = round (log $ fromIntegral n) f = round (log 2) Otherwise it seems fine. On Sun, Dec 1, 2013 at 2:22 AM, willie ekaputra wrote: > Hi everyone ! > I am newbie and I made this code for counting k, so that 2^k divisor of > n.Somehow it doesn't work. > Anyone knows what is wrong? > > Regards and thanks. > Wili. > > maxexp2:: Int -> Int > maxexp2 n > |n== 0 || 2^k 'mod' n /=0 =0 > |otherwise = k > Where > k= e ' div' f > e=round (fromIntegral (log n)) > f = round (fromIntegral (log 2)) > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mukeshtiwari.iiitm at gmail.com Sun Dec 1 08:17:03 2013 From: mukeshtiwari.iiitm at gmail.com (mukesh tiwari) Date: Sun, 1 Dec 2013 13:47:03 +0530 Subject: [Haskell-beginners] This code does not work : conversion error In-Reply-To: References: Message-ID: Hi Willie, Here is the code modified maxexp2:: Int -> Int maxexp2 n |n== 0 || 2^k `mod` n /=0 =0 |otherwise = k where k = e `div` f e = round ( log ( fromIntegral n ) ) f = round ( (log 2.0 )) When you computing k then use backticks (`) [1] not the single quote ( ' ) [1] http://book.realworldhaskell.org/read/functional-programming.html( See Infix function ) On Sun, Dec 1, 2013 at 12:52 PM, willie ekaputra wrote: > Hi everyone ! > I am newbie and I made this code for counting k, so that 2^k divisor of > n.Somehow it doesn't work. > Anyone knows what is wrong? > > Regards and thanks. > Wili. > > maxexp2:: Int -> Int > maxexp2 n > |n== 0 || 2^k 'mod' n /=0 =0 > |otherwise = k > Where > k= e ' div' f > e=round (fromIntegral (log n)) > f = round (fromIntegral (log 2)) > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From patrick.browne at dit.ie Sun Dec 1 12:52:42 2013 From: patrick.browne at dit.ie (Patrick Browne) Date: Sun, 1 Dec 2013 12:52:42 +0000 Subject: [Haskell-beginners] Equality instance for lists In-Reply-To: <20131201032127.GA6944@seas.upenn.edu> References: <7410f2a45dd5.529a697b@dit.ie> <20131201032127.GA6944@seas.upenn.edu> Message-ID: <7470afb66035.529b311a@dit.ie> An HTML attachment was scrubbed... URL: From math.simplex at gmail.com Sun Dec 1 14:16:58 2013 From: math.simplex at gmail.com (Graham Gill) Date: Sun, 01 Dec 2013 09:16:58 -0500 Subject: [Haskell-beginners] This code does not work : conversion error In-Reply-To: References: Message-ID: <529B44DA.3020902@gmail.com> Once you've made those changes, you also need n `mod` 2^k instead of 2^k `mod` n. Finally, using e `div` f, and round() in the definitions of e and f, to give you the largest power of 2 dividing n doesn't work correctly. For example: maxexp2 4 = 1 (should be 2) maxexp2 16 = 3 (should be 4) maxexp2 18 = 0 (should be 1) maxexp2 28 = 0 (should be 2) But that's not a Haskell error, that's a problem with the algorithm. (Sorry if I've misinterpreted what you're trying to do.) Graham On 01/12/2013 3:17 AM, mukesh tiwari wrote: > Hi Willie, > Here is the code modified > maxexp2:: Int -> Int > maxexp2 n > |n== 0 || 2^k `mod` n /=0 =0 > |otherwise = k > where > k = e `div` f > e = round ( log ( fromIntegral n ) ) > f = round ( (log 2.0 )) > > When you computing k then use backticks (`) [1] not the single quote > ( ' ) > > [1] http://book.realworldhaskell.org/read/functional-programming.html( > > See Infix function ) > > > On Sun, Dec 1, 2013 at 12:52 PM, willie ekaputra > > wrote: > > Hi everyone ! > I am newbie and I made this code for counting k, so that 2^k > divisor of n.Somehow it doesn't work. > Anyone knows what is wrong? > > Regards and thanks. > Wili. > > maxexp2:: Int -> Int > maxexp2 n > |n== 0 || 2^k 'mod' n /=0 =0 > |otherwise = k > Where > k= e ' div' f > e=round (fromIntegral (log n)) > f = round (fromIntegral (log 2)) > > > _______________________________________________ > 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 plredmond at gmail.com Sun Dec 1 22:30:50 2013 From: plredmond at gmail.com (Patrick Redmond) Date: Mon, 2 Dec 2013 11:30:50 +1300 Subject: [Haskell-beginners] Overflow when reading C types Message-ID: Prelude> import Foreign.C.Types Prelude Foreign.C.Types> read "-10" :: CUInt 4294967286 Prelude Foreign.C.Types> read "300" :: CChar 44 This seems like a bug. Shouldn't these result in some kind of read error? The values expressed as strings are simply not part of the type they are being parsed into. However, Haskell seems to parse them into an arbitrarily wide numeric type, and then overflow them down to the correct size. What's the rationale here? From ml at extensibl.com Sun Dec 1 22:38:33 2013 From: ml at extensibl.com (ml at extensibl.com) Date: Mon, 2 Dec 2013 11:38:33 +1300 Subject: [Haskell-beginners] Overflow when reading C types In-Reply-To: References: Message-ID: <20131201223833.GA2954@li165-50.members.linode.com> On Mon, Dec 02, 2013 at 11:30:50AM +1300, Patrick Redmond wrote: > Prelude> import Foreign.C.Types > Prelude Foreign.C.Types> read "-10" :: CUInt > 4294967286 > Prelude Foreign.C.Types> read "300" :: CChar > 44 > CUInt? I would try CInt instead. A. From ml at extensibl.com Sun Dec 1 23:09:30 2013 From: ml at extensibl.com (ml at extensibl.com) Date: Mon, 2 Dec 2013 12:09:30 +1300 Subject: [Haskell-beginners] Overflow when reading C types In-Reply-To: <20131201223833.GA2954@li165-50.members.linode.com> References: <20131201223833.GA2954@li165-50.members.linode.com> Message-ID: <20131201230930.GB2954@li165-50.members.linode.com> On Mon, Dec 02, 2013 at 11:38:33AM +1300, ml at extensibl.com wrote: > On Mon, Dec 02, 2013 at 11:30:50AM +1300, Patrick Redmond wrote: > > Prelude> import Foreign.C.Types > > Prelude Foreign.C.Types> read "-10" :: CUInt > > 4294967286 > > Prelude Foreign.C.Types> read "300" :: CChar > > 44 > > > > CUInt? I would try CInt instead. > Whoops, that is not related to the original question, sorry. From patrick.browne at dit.ie Mon Dec 2 00:08:42 2013 From: patrick.browne at dit.ie (Patrick Browne) Date: Mon, 2 Dec 2013 00:08:42 +0000 Subject: [Haskell-beginners] Understanding inheritance Message-ID: <7470d5ac4ff.529bcf8a@dit.ie> An HTML attachment was scrubbed... URL: From zhiwudazhanjiangshi at gmail.com Mon Dec 2 07:53:22 2013 From: zhiwudazhanjiangshi at gmail.com (yi lu) Date: Mon, 2 Dec 2013 15:53:22 +0800 Subject: [Haskell-beginners] How to save a bracket in this case? Message-ID: Hi, I want to calculate *(81/10)^2*. However, after I typed *81/10*, I remembered to add a bracket to surround *81/10*. Is there one way to do some trick to save this bracket? Actually I can *Ctrl+A* to move to the first character of this line. I want the other solution. Yi -------------- next part -------------- An HTML attachment was scrubbed... URL: From vikraman.choudhury at gmail.com Mon Dec 2 08:09:50 2013 From: vikraman.choudhury at gmail.com (Vikraman) Date: Mon, 2 Dec 2013 13:39:50 +0530 Subject: [Haskell-beginners] How to save a bracket in this case? In-Reply-To: References: Message-ID: <20131202080950.GA11470@felicia.iitk.ac.in> On Mon, Dec 02, 2013 at 03:53:22PM +0800, yi lu wrote: > Hi, > > I want to calculate > *(81/10)^2*. > > However, after I typed *81/10*, I remembered to add a bracket to surround > *81/10*. Is there one way to do some trick to save this bracket? > > Actually I can *Ctrl+A* to move to the first character of this line. I want > the other solution. > (1) 81/10 * 81/10 (2) Enter 81/10 The result gets saved in it Now, it^2 -- Vikraman From orclev at gmail.com Mon Dec 2 14:21:02 2013 From: orclev at gmail.com (Kyle Murphy) Date: Mon, 2 Dec 2013 09:21:02 -0500 Subject: [Haskell-beginners] Understanding inheritance In-Reply-To: <7470d5ac4ff.529bcf8a@dit.ie> References: <7470d5ac4ff.529bcf8a@dit.ie> Message-ID: I think you're headed down a path that's only going to cause you confusion. You shouldn't think in OO terms like sub and super classes. Each class is its own thing, they aren't sub and super classes in the OO sense. A class my have a constraint applied to it such that any type that is an instance of that class, must also be an instance of one or more other classes. That constraint is what allows you to use functions that belong to other classes inside of default function definitions. Semantically this behaves much like inheritance in an OO language, however functionally it's very different. On Dec 1, 2013 7:08 PM, "Patrick Browne" wrote: > Hi, > In the example below does the concept of inheritance only apply to classes > and not instances? > By inheritance I mean that a method in a sub-class can use a method from > the super-class but not vice versa. > Would the inclusion of instance contexts such as 'instance (Eq a, Show b) > => MyClass a b' apply such inheritance semantics between LHS => RHS of > instances? > My current misunderstandings are in the comments. > Thanks, > Pat > -- Any instance of SUPER must define the super method. The super method > definition may use any function in scope on the RHS of equations. > -- If the default method is defined in the class it may use any method in > scope except those from the sub-class > class SUPER a where > super :: a -> a > -- Any instance of SUB must define sub. The sub method definition may use > super or any function in scope on the RHS of equations > class SUPER a => SUB a where > sub :: a -> a > > -- This instance defines super and can use sub because sub it is defined > and is in scope > instance SUPER Int where > super n = 1 + (sub n) > > -- This instance defines sub > instance SUB Int where > sub n = 6 + n > > -- The Char instances differs from the Int instances in that the SUB uses > super. > instance SUPER Char where > super n = 's' > > -- The use of super here because it is defined and is in scope. > instance SUB Char where > sub n = super n > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From poczta at emanuelkoczwara.pl Mon Dec 2 14:35:53 2013 From: poczta at emanuelkoczwara.pl (Emanuel Koczwara) Date: Mon, 02 Dec 2013 15:35:53 +0100 Subject: [Haskell-beginners] Understanding inheritance In-Reply-To: References: <7470d5ac4ff.529bcf8a@dit.ie> Message-ID: <1385994953.13699.7.camel@emanuel-laptop> Hi, From perspective of a haskell beginner coming from OOP: Tt's like interfaces. If a class supports interface X, then it must also supports interface Y. That's all. It's a simple thing, but can be complicated if you will try to understand it in OOP terms. Emanuel From plredmond at gmail.com Mon Dec 2 22:05:06 2013 From: plredmond at gmail.com (Patrick Redmond) Date: Tue, 3 Dec 2013 11:05:06 +1300 Subject: [Haskell-beginners] Overflow when reading C types In-Reply-To: <20131201230930.GB2954@li165-50.members.linode.com> References: <20131201223833.GA2954@li165-50.members.linode.com> <20131201230930.GB2954@li165-50.members.linode.com> Message-ID: Yeah, the unsigned is to demonstrate how "-10" is being interpreted as a number before being cast to an unsigned. My question is: Why isn't this just a read/parse error? "-10" isn't a valid representation for any value of the CUInt type. On Monday, December 2, 2013, wrote: > On Mon, Dec 02, 2013 at 11:38:33AM +1300, ml at extensibl.com wrote: > > On Mon, Dec 02, 2013 at 11:30:50AM +1300, Patrick Redmond wrote: > > > Prelude> import Foreign.C.Types > > > Prelude Foreign.C.Types> read "-10" :: CUInt > > > 4294967286 > > > Prelude Foreign.C.Types> read "300" :: CChar > > > 44 > > > > > > > CUInt? I would try CInt instead. > > > > Whoops, that is not related to the original question, sorry. > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at orlitzky.com Mon Dec 2 22:09:22 2013 From: michael at orlitzky.com (Michael Orlitzky) Date: Mon, 02 Dec 2013 17:09:22 -0500 Subject: [Haskell-beginners] Overflow when reading C types In-Reply-To: References: <20131201223833.GA2954@li165-50.members.linode.com> <20131201230930.GB2954@li165-50.members.linode.com> Message-ID: <529D0512.7060206@orlitzky.com> On 12/02/2013 05:05 PM, Patrick Redmond wrote: > Yeah, the unsigned is to demonstrate how "-10" is being interpreted as a > number before being cast to an unsigned. > > My question is: Why isn't this just a read/parse error? "-10" isn't a > valid representation for any value of the CUInt type. > Sure it is, unsigned int x = -10; If you don't want a CUInt, don't use a CUInt =) From ml at isaac.cedarswampstudios.org Mon Dec 2 23:14:20 2013 From: ml at isaac.cedarswampstudios.org (Isaac Dupree) Date: Mon, 02 Dec 2013 18:14:20 -0500 Subject: [Haskell-beginners] Overflow when reading C types In-Reply-To: <529D0512.7060206@orlitzky.com> References: <20131201223833.GA2954@li165-50.members.linode.com> <20131201230930.GB2954@li165-50.members.linode.com> <529D0512.7060206@orlitzky.com> Message-ID: <529D144C.5070401@isaac.cedarswampstudios.org> On 12/02/2013 05:09 PM, Michael Orlitzky wrote: > On 12/02/2013 05:05 PM, Patrick Redmond wrote: >> Yeah, the unsigned is to demonstrate how "-10" is being interpreted as a >> number before being cast to an unsigned. >> >> My question is: Why isn't this just a read/parse error? "-10" isn't a >> valid representation for any value of the CUInt type. >> > > Sure it is, > > unsigned int x = -10; > > If you don't want a CUInt, don't use a CUInt =) That is a C integral->integral conversion. A better comparison for Haskell "read", if you think C gets to define the Haskell conversion from Haskell string to C integral type, would be strtol()/strtoul(), which are standard C functions that convert from C string to C integral type. strtol() saturates at LONG_MIN and LONG_MAX. strtoul() saturates at ULONG_MAX and is modulo at 0 (the first time; if the number is too negative then it saturates to ULONG_MAX). Both set errno to ERANGE when they saturate. C conversions from floating-point to signed or unsigned integral also saturate. Unsigned types being Z/nZ is mathematically sound, but C is not very dedicated to this interpretation. Furthermore, C signed arithmetic is undefined behavior if you overflow. Haskell is much more dedicated to thinking both signed and unsigned C types are modulo than C is. I too am curious whether it would make more sense for Haskell read/readsPrec to fail to read out-of-range integers. -Isaac From daniel.is.fischer at googlemail.com Tue Dec 3 00:14:09 2013 From: daniel.is.fischer at googlemail.com (Daniel Fischer) Date: Tue, 03 Dec 2013 01:14:09 +0100 Subject: [Haskell-beginners] Overflow when reading C types In-Reply-To: <529D144C.5070401@isaac.cedarswampstudios.org> References: <529D0512.7060206@orlitzky.com> <529D144C.5070401@isaac.cedarswampstudios.org> Message-ID: <1653050.Djmnj83oKT@linux-hpeb.site> On Monday 02 December 2013, 18:14:20, Isaac Dupree wrote: > C conversions from floating-point to signed or unsigned integral also > saturate. Not really. Clause 6.3.1.4 is quite explicit: "When a finite value of real floating type is converted to an integer type other than _Bool, the fractional part is discarded (i.e., the value is truncated toward zero). If the value of the integral part cannot be represented by the integer type, the behavior is undefined." and adds a footnote to make it unmistakeably clear that the remaindering operation need not be carried out when the target type is unsigned. > > Unsigned types being Z/nZ is mathematically sound, but C is not very > dedicated to this interpretation. It's mandated in 6.2.5 (9), "A computation involving unsigned operands can never overflow, because a result that cannot be represented by the resulting unsigned integer type is reduced modulo the number that is one greater than the largest value that can be represented by the resulting type." > Furthermore, C signed arithmetic is undefined behavior if you overflow. That cannot be stressed too much. From ml at isaac.cedarswampstudios.org Tue Dec 3 02:40:01 2013 From: ml at isaac.cedarswampstudios.org (Isaac Dupree) Date: Mon, 02 Dec 2013 21:40:01 -0500 Subject: [Haskell-beginners] Overflow when reading C types In-Reply-To: <1653050.Djmnj83oKT@linux-hpeb.site> References: <529D0512.7060206@orlitzky.com> <529D144C.5070401@isaac.cedarswampstudios.org> <1653050.Djmnj83oKT@linux-hpeb.site> Message-ID: <529D4481.1040508@isaac.cedarswampstudios.org> On 12/02/2013 07:14 PM, Daniel Fischer wrote: > On Monday 02 December 2013, 18:14:20, Isaac Dupree wrote: >> C conversions from floating-point to signed or unsigned integral also >> saturate. > > Not really. Clause 6.3.1.4 is quite explicit: > > "When a finite value of real floating type is converted to an integer type > other than _Bool, the fractional part is discarded (i.e., the value is > truncated toward zero). If the value of the integral part cannot be > represented by the integer type, the behavior is undefined." > > and adds a footnote to make it unmistakeably clear that the remaindering > operation need not be carried out when the target type is unsigned. Whoops! Thank you for correcting me. >> Unsigned types being Z/nZ is mathematically sound, but C is not very >> dedicated to this interpretation. > > It's mandated in 6.2.5 (9), > > "A computation involving unsigned operands can never overflow, because a > result that cannot be represented by the resulting unsigned integer type is > reduced modulo the number that is one greater than the largest value that can > be represented by the resulting type." Yes, indeed, C unsigned arithmetic *is* Z/nZ and that is lovely (when you want it, at least). My point there was that some functions/operations specified by the C standard that are related to unsigned types, like conversion from strings (strtoul()) and floats (casting), aren't modulo 2^n. I see that's a weak point since each of those only differ from modulo in error conditions (errno set, or undefined behaviour). If C was as good as(?) Haskell it might use modulo for those conversions too. -Isaac From shaegis at gmail.com Sun Dec 8 00:21:32 2013 From: shaegis at gmail.com (S. H. Aegis) Date: Sun, 8 Dec 2013 09:21:32 +0900 Subject: [Haskell-beginners] How can I read package document? Message-ID: Hi. I'm new to Haskell. I installed Palindromes package through cabal. But I don't know the usage of command. (Not enough information on Home Page.) How can I read document? Thank you. =) -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuuzetsu at fuuzetsu.co.uk Sun Dec 8 00:51:56 2013 From: fuuzetsu at fuuzetsu.co.uk (Mateusz Kowalczyk) Date: Sun, 08 Dec 2013 00:51:56 +0000 Subject: [Haskell-beginners] How can I read package document? In-Reply-To: References: Message-ID: <52A3C2AC.2080409@fuuzetsu.co.uk> On 08/12/13 00:21, S. H. Aegis wrote: > Hi. I'm new to Haskell. > I installed Palindromes package through cabal. > But I don't know the usage of command. > (Not enough information on Home Page.) > How can I read document? > Thank you. =) > > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > Usually you'd check the documentation on Hackage[1] and if that's not enough, you'd seek help in the source itself[2]. In this case, there are some comments in the source that might interest you. [1]: http://hackage.haskell.org/package/palindromes [2]: http://hackage.haskell.org/package/palindromes-0.4/docs/src/Data-Algorithms-Palindromes-Palindromes.html -- Mateusz K. From shaegis at gmail.com Sun Dec 8 05:23:58 2013 From: shaegis at gmail.com (S. H. Aegis) Date: Sun, 8 Dec 2013 14:23:58 +0900 Subject: [Haskell-beginners] How can I read package document? In-Reply-To: <52A3C2AC.2080409@fuuzetsu.co.uk> References: <52A3C2AC.2080409@fuuzetsu.co.uk> Message-ID: <-2703127754525991104@unknownmsgid> Thank you so much ! I wish have a nice day . Sok H. Chang 2013. 12. 8. ?? 9:52 Mateusz Kowalczyk ??: >> On 08/12/13 00:21, S. H. Aegis wrote: >> Hi. I'm new to Haskell. >> I installed Palindromes package through cabal. >> But I don't know the usage of command. >> (Not enough information on Home Page.) >> How can I read document? >> Thank you. =) >> >> >> >> _______________________________________________ >> Beginners mailing list >> Beginners at haskell.org >> http://www.haskell.org/mailman/listinfo/beginners > Usually you'd check the documentation on Hackage[1] and if that's not > enough, you'd seek help in the source itself[2]. In this case, there are > some comments in the source that might interest you. > > [1]: http://hackage.haskell.org/package/palindromes > [2]: > http://hackage.haskell.org/package/palindromes-0.4/docs/src/Data-Algorithms-Palindromes-Palindromes.html > > -- > Mateusz K. > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners From sammuel.coles at gmail.com Sun Dec 8 08:13:32 2013 From: sammuel.coles at gmail.com (Sam Coles) Date: Sun, 8 Dec 2013 02:13:32 -0600 Subject: [Haskell-beginners] How can I read package document? In-Reply-To: <-2703127754525991104@unknownmsgid> References: <52A3C2AC.2080409@fuuzetsu.co.uk> <-2703127754525991104@unknownmsgid> Message-ID: You can also run the commands below to generate the documentation. This is very useful because some of the documentation on the new hackage is broken/incomplete. cd ~/src cabal unpack palindromes #untars the package into a dir in the current dir cd palindromes-0.4 cabal configure cabal haddock #generates documentation cd dist/doc/html/palindromes/ #index.html is in this directory On Sat, Dec 7, 2013 at 11:23 PM, S. H. Aegis wrote: > Thank you so much ! > I wish have a nice day . > > Sok H. Chang > > 2013. 12. 8. ?? 9:52 Mateusz Kowalczyk ??: > > >> On 08/12/13 00:21, S. H. Aegis wrote: > >> Hi. I'm new to Haskell. > >> I installed Palindromes package through cabal. > >> But I don't know the usage of command. > >> (Not enough information on Home Page.) > >> How can I read document? > >> Thank you. =) > >> > >> > >> > >> _______________________________________________ > >> Beginners mailing list > >> Beginners at haskell.org > >> http://www.haskell.org/mailman/listinfo/beginners > > Usually you'd check the documentation on Hackage[1] and if that's not > > enough, you'd seek help in the source itself[2]. In this case, there are > > some comments in the source that might interest you. > > > > [1]: http://hackage.haskell.org/package/palindromes > > [2]: > > > http://hackage.haskell.org/package/palindromes-0.4/docs/src/Data-Algorithms-Palindromes-Palindromes.html > > > > -- > > Mateusz K. > > _______________________________________________ > > 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 shaegis at gmail.com Sun Dec 8 08:57:07 2013 From: shaegis at gmail.com (S. H. Aegis) Date: Sun, 8 Dec 2013 17:57:07 +0900 Subject: [Haskell-beginners] How can I read package document? In-Reply-To: References: <52A3C2AC.2080409@fuuzetsu.co.uk> <-2703127754525991104@unknownmsgid> Message-ID: <-1553686211342827818@unknownmsgid> Thank you so much. This is what I want. =) Have a nice day. Sok H. Chang 2013. 12. 8. ?? 5:13 Sam Coles ??: You can also run the commands below to generate the documentation. This is very useful because some of the documentation on the new hackage is broken/incomplete. cd ~/src cabal unpack palindromes #untars the package into a dir in the current dir cd palindromes-0.4 cabal configure cabal haddock #generates documentation cd dist/doc/html/palindromes/ #index.html is in this directory On Sat, Dec 7, 2013 at 11:23 PM, S. H. Aegis wrote: > Thank you so much ! > I wish have a nice day . > > Sok H. Chang > > 2013. 12. 8. ?? 9:52 Mateusz Kowalczyk ??: > > >> On 08/12/13 00:21, S. H. Aegis wrote: > >> Hi. I'm new to Haskell. > >> I installed Palindromes package through cabal. > >> But I don't know the usage of command. > >> (Not enough information on Home Page.) > >> How can I read document? > >> Thank you. =) > >> > >> > >> > >> _______________________________________________ > >> Beginners mailing list > >> Beginners at haskell.org > >> http://www.haskell.org/mailman/listinfo/beginners > > Usually you'd check the documentation on Hackage[1] and if that's not > > enough, you'd seek help in the source itself[2]. In this case, there are > > some comments in the source that might interest you. > > > > [1]: http://hackage.haskell.org/package/palindromes > > [2]: > > > http://hackage.haskell.org/package/palindromes-0.4/docs/src/Data-Algorithms-Palindromes-Palindromes.html > > > > -- > > Mateusz K. > > _______________________________________________ > > 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 michaeltbaker at gmail.com Mon Dec 9 21:11:36 2013 From: michaeltbaker at gmail.com (Michael Baker) Date: Mon, 9 Dec 2013 15:11:36 -0600 Subject: [Haskell-beginners] Cabal build dependency using a git repo Message-ID: I have a library which isn't on Hackage that I would like to use as a build dependency in another project. In Rubygems you can provide a git repository in the absence of an actual Rubygems repository. Does Cabal support something like that? I would like to specify that a particular build depend can be fetched from a given git repository rather than from Hackage and have Cabal fetch it when installing the build dependencies. I'm guessing that it's not possible because I don't see a mention of this feature anywhere. If it's not possible, how do people typically handle this problem? Git submodules? -------------- next part -------------- An HTML attachment was scrubbed... URL: From mlists at pmade.com Mon Dec 9 21:45:07 2013 From: mlists at pmade.com (Peter Jones) Date: Mon, 09 Dec 2013 14:45:07 -0700 Subject: [Haskell-beginners] Cabal build dependency using a git repo References: Message-ID: <87a9g9lmvw.fsf@pmade.com> Michael Baker writes: > I have a library which isn't on Hackage that I would like to use as a build > dependency in another project. In Rubygems you can provide a git repository > in the absence of an actual Rubygems repository. Use a git submodule (or place the source code to the package anywhere on your file system) then use `cabal sandbox add-source `. Provided of course that you're using cabal sandboxes. -- Peter Jones, Founder, Devalot.com Defending the honor of good code From michaeltbaker at gmail.com Mon Dec 9 23:02:56 2013 From: michaeltbaker at gmail.com (Michael Baker) Date: Mon, 9 Dec 2013 17:02:56 -0600 Subject: [Haskell-beginners] Cabal build dependency using a git repo In-Reply-To: <87a9g9lmvw.fsf@pmade.com> References: <87a9g9lmvw.fsf@pmade.com> Message-ID: On Mon, Dec 9, 2013 at 3:45 PM, Peter Jones wrote: > > Michael Baker writes: > > I have a library which isn't on Hackage that I would like to use as a build > > dependency in another project. In Rubygems you can provide a git repository > > in the absence of an actual Rubygems repository. > > Use a git submodule (or place the source code to the package anywhere on > your file system) then use `cabal sandbox add-source `. Provided > of course that you're using cabal sandboxes. What is commonly done if you aren't using sandboxes? I would rather not use them in an effort to make installing this project easier on my users, because the current Haskell Platform doesn't have sandboxes yet. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuuzetsu at fuuzetsu.co.uk Tue Dec 10 01:23:50 2013 From: fuuzetsu at fuuzetsu.co.uk (Mateusz Kowalczyk) Date: Tue, 10 Dec 2013 01:23:50 +0000 Subject: [Haskell-beginners] Cabal build dependency using a git repo In-Reply-To: References: <87a9g9lmvw.fsf@pmade.com> Message-ID: <52A66D26.6010200@fuuzetsu.co.uk> On 09/12/13 23:02, Michael Baker wrote: > On Mon, Dec 9, 2013 at 3:45 PM, Peter Jones wrote: >> >> Michael Baker writes: >>> I have a library which isn't on Hackage that I would like to use as a > build >>> dependency in another project. In Rubygems you can provide a git > repository >>> in the absence of an actual Rubygems repository. >> >> Use a git submodule (or place the source code to the package anywhere on >> your file system) then use `cabal sandbox add-source `. Provided >> of course that you're using cabal sandboxes. > > What is commonly done if you aren't using sandboxes? I would rather not use > them in an effort to make installing this project easier on my users, > because the current Haskell Platform doesn't have sandboxes yet. > > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > Sandboxes are for development. If you really want to make it easy for your users, publish your other package to Hackage. If that's not an option, perhaps require them to install the other package manually first? Maybe provide a script which fetches sources and cabal installs. -- Mateusz K. From miroslav.karpis at gmail.com Tue Dec 10 05:13:36 2013 From: miroslav.karpis at gmail.com (Miro Karpis) Date: Tue, 10 Dec 2013 06:13:36 +0100 Subject: [Haskell-beginners] setting up haskell-mode in gnu-emacs (OSX) Message-ID: Hi, I'm having troubles to set-up haskell-mode in gnu-emacs. I'm new to emacs,... Instructions says: via package manager add: M-x package-install haskell-mode I can open package manager, but where should I paste the command? Thanks, m. -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Tue Dec 10 05:27:37 2013 From: allbery.b at gmail.com (Brandon Allbery) Date: Tue, 10 Dec 2013 00:27:37 -0500 Subject: [Haskell-beginners] setting up haskell-mode in gnu-emacs (OSX) In-Reply-To: References: Message-ID: On Tue, Dec 10, 2013 at 12:13 AM, Miro Karpis wrote: > I'm having troubles to set-up haskell-mode in gnu-emacs. I'm new to > emacs,... > Instructions says: via package manager add: M-x package-install > haskell-mode > I can open package manager, but where should I paste the command? > That's not really pasteable as such. M-x refers to pressing Meta-x (for a terminal this may not be available without special configuration) or Esc followed by x. is the Return key. So: press Esc, x (minibuffer shows "M-x "), type "package-install", press Return, type "haskell-mode", press Return. (If you have configured Terminal to use Option for Meta --- this is not default as it disables internationalization --- then you can press Option-x instead of Esc followed by x.) -- 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 miroslav.karpis at gmail.com Tue Dec 10 06:19:15 2013 From: miroslav.karpis at gmail.com (Miro Karpis) Date: Tue, 10 Dec 2013 07:19:15 +0100 Subject: [Haskell-beginners] setting up haskell-mode in gnu-emacs (OSX) In-Reply-To: References: Message-ID: Thanks, now I'm getting "Install package: haskell-mode[No match]". I'm doing this via gnu-emacs in OSX Do I need to download the package and place it somewhere? Thanks, m. On Tue, Dec 10, 2013 at 6:27 AM, Brandon Allbery wrote: > On Tue, Dec 10, 2013 at 12:13 AM, Miro Karpis wrote: > >> I'm having troubles to set-up haskell-mode in gnu-emacs. I'm new to >> emacs,... >> Instructions says: via package manager add: M-x package-install >> haskell-mode >> I can open package manager, but where should I paste the command? >> > > That's not really pasteable as such. > > M-x refers to pressing Meta-x (for a terminal this may not be available > without special configuration) or Esc followed by x. is the Return > key. > > So: press Esc, x (minibuffer shows "M-x "), type "package-install", press > Return, type "haskell-mode", press Return. (If you have configured Terminal > to use Option for Meta --- this is not default as it disables > internationalization --- then you can press Option-x instead of Esc > followed by x.) > > -- > 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 voldermort at hotmail.com Tue Dec 10 09:28:06 2013 From: voldermort at hotmail.com (harry) Date: Tue, 10 Dec 2013 09:28:06 +0000 (UTC) Subject: [Haskell-beginners] download latest version of cabal-install from hackage Message-ID: I'm trying to write a script that will download and install the latest version of cabal-install. However, I can't find a URL to automatically fetch the latest version. How can this be done? From zhiwudazhanjiangshi at gmail.com Tue Dec 10 09:43:07 2013 From: zhiwudazhanjiangshi at gmail.com (yi lu) Date: Tue, 10 Dec 2013 17:43:07 +0800 Subject: [Haskell-beginners] download latest version of cabal-install from hackage In-Reply-To: References: Message-ID: Click any package in hackage http://hackage.haskell.org/package/data-aviary See what it will download. Remember the package dependencies. Yi On Tue, Dec 10, 2013 at 5:28 PM, harry wrote: > I'm trying to write a script that will download and install the latest > version of cabal-install. However, I can't find a URL to automatically > fetch > the latest version. How can this be done? > > _______________________________________________ > 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 Tue Dec 10 10:16:57 2013 From: voldermort at hotmail.com (harry) Date: Tue, 10 Dec 2013 10:16:57 +0000 (UTC) Subject: [Haskell-beginners] =?utf-8?q?download_latest_version_of_cabal-in?= =?utf-8?q?stall=09from_hackage?= References: Message-ID: yi lu gmail.com> writes: > Click any package in hackage http://hackage.haskell.org/package/data-aviary > See what it will download. > Remember the package dependencies. > Yi > > > On Tue, Dec 10, 2013 at 5:28 PM, harry hotmail.com> wrote:I'm trying to write a script that will download and install the latest > version of cabal-install. However, I can't find a URL to automatically fetch > the latest version. How can this be done? That's good for humans :) I'm trying to download the latest version of the tar.gz from a script. I guess I could scrape the URL from http://hackage.haskell.org/package/cabal-install, but I'm looking for a cleaner solution. From zhiwudazhanjiangshi at gmail.com Tue Dec 10 11:12:03 2013 From: zhiwudazhanjiangshi at gmail.com (yi lu) Date: Tue, 10 Dec 2013 19:12:03 +0800 Subject: [Haskell-beginners] download latest version of cabal-install from hackage In-Reply-To: References: Message-ID: In ~/.cabal/pachages/hackage.haskell.org/ folder, there is a list of files in 00-index.tar.gz . For example http://hackage.haskell.org/package/data-aviary , there is a folder `data-aviary`. In it, there are folders `0.4.0`, `0.2.3` ... In http://hackage.haskell.org/package/data-aviary , the download link is http://hackage.haskell.org/package/data-aviary-0.4.0/data-aviary-0.4.0.tar.gz So now, can you infer something from this? Yi On Tue, Dec 10, 2013 at 6:16 PM, harry wrote: > yi lu gmail.com> writes: > > > Click any package in hackage > http://hackage.haskell.org/package/data-aviary > > See what it will download. > > Remember the package dependencies. > > Yi > > > > > > On Tue, Dec 10, 2013 at 5:28 PM, harry hotmail.com> > wrote:I'm trying to write a script that will download and install the > latest > > version of cabal-install. However, I can't find a URL to automatically > fetch > > the latest version. How can this be done? > > That's good for humans :) > > I'm trying to download the latest version of the tar.gz from a script. I > guess I could scrape the URL from > http://hackage.haskell.org/package/cabal-install, but I'm looking for a > cleaner solution. > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mlists at pmade.com Tue Dec 10 15:44:19 2013 From: mlists at pmade.com (Peter Jones) Date: Tue, 10 Dec 2013 08:44:19 -0700 Subject: [Haskell-beginners] Cabal build dependency using a git repo References: <87a9g9lmvw.fsf@pmade.com> Message-ID: <87siu0k8x8.fsf@pmade.com> Michael Baker writes: > On Mon, Dec 9, 2013 at 3:45 PM, Peter Jones wrote: >> >> Michael Baker writes: >> > I have a library which isn't on Hackage that I would like to use as a > build >> > dependency in another project. In Rubygems you can provide a git > repository >> > in the absence of an actual Rubygems repository. >> >> Use a git submodule (or place the source code to the package anywhere on >> your file system) then use `cabal sandbox add-source `. Provided >> of course that you're using cabal sandboxes. > > What is commonly done if you aren't using sandboxes? I would rather > not use them in an effort to make installing this project easier on my > users, because the current Haskell Platform doesn't have sandboxes > yet. I believe it's possible to run your own installation of the Hackage server or at least host packages on a web server under a specific directory structure. You can then configure cabal to fetch packages from your private Hackage mirror. Then you just host your private packages and any necessary public packages. More details: http://comonad.com/reader/2012/hackage-mirror/ -- Peter Jones, Founder, Devalot.com Defending the honor of good code From michaeltbaker at gmail.com Tue Dec 10 15:55:35 2013 From: michaeltbaker at gmail.com (Michael Baker) Date: Tue, 10 Dec 2013 09:55:35 -0600 Subject: [Haskell-beginners] Cabal build dependency using a git repo In-Reply-To: <87siu0k8x8.fsf@pmade.com> References: <87a9g9lmvw.fsf@pmade.com> <87siu0k8x8.fsf@pmade.com> Message-ID: Ok, I'll try that. Thanks. On Tue, Dec 10, 2013 at 9:44 AM, Peter Jones wrote: > Michael Baker writes: > > On Mon, Dec 9, 2013 at 3:45 PM, Peter Jones wrote: > >> > >> Michael Baker writes: > >> > I have a library which isn't on Hackage that I would like to use as a > > build > >> > dependency in another project. In Rubygems you can provide a git > > repository > >> > in the absence of an actual Rubygems repository. > >> > >> Use a git submodule (or place the source code to the package anywhere on > >> your file system) then use `cabal sandbox add-source `. Provided > >> of course that you're using cabal sandboxes. > > > > What is commonly done if you aren't using sandboxes? I would rather > > not use them in an effort to make installing this project easier on my > > users, because the current Haskell Platform doesn't have sandboxes > > yet. > > I believe it's possible to run your own installation of the Hackage > server or at least host packages on a web server under a specific > directory structure. You can then configure cabal to fetch packages > from your private Hackage mirror. Then you just host your private > packages and any necessary public packages. More details: > > http://comonad.com/reader/2012/hackage-mirror/ > > -- > Peter Jones, Founder, Devalot.com > Defending the honor of good code > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From miroslav.karpis at gmail.com Wed Dec 11 08:40:41 2013 From: miroslav.karpis at gmail.com (Miro Karpis) Date: Wed, 11 Dec 2013 09:40:41 +0100 Subject: [Haskell-beginners] aquamacs - history interpreter Message-ID: Hi, please,..... I have started to use aquamacs and their haskell interpreter. Only problem is that I don't know how to access interpreter commands history. Usually it would be key UP/DOWN, but that will move the cursor UP/DOWN. So,... please how can I access interpreter/console user commands history in aquamacs? Cheers, Miro -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuuzetsu at fuuzetsu.co.uk Wed Dec 11 08:46:01 2013 From: fuuzetsu at fuuzetsu.co.uk (Mateusz Kowalczyk) Date: Wed, 11 Dec 2013 08:46:01 +0000 Subject: [Haskell-beginners] aquamacs - history interpreter In-Reply-To: References: Message-ID: <52A82649.1050908@fuuzetsu.co.uk> On 11/12/13 08:40, Miro Karpis wrote: > Hi, please,..... I have started to use aquamacs and their haskell > interpreter. Only problem is that I don't know how to access interpreter > commands history. Usually it would be key UP/DOWN, but that will move the > cursor UP/DOWN. So,... please how can I access interpreter/console user > commands history in aquamacs? > > Cheers, > Miro > > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > Try M-p. C-c C-l seems to bring up input history. -- Mateusz K. From miroslav.karpis at gmail.com Wed Dec 11 09:00:11 2013 From: miroslav.karpis at gmail.com (Miro Karpis) Date: Wed, 11 Dec 2013 10:00:11 +0100 Subject: [Haskell-beginners] aquamacs - history interpreter In-Reply-To: <52A82649.1050908@fuuzetsu.co.uk> References: <52A82649.1050908@fuuzetsu.co.uk> Message-ID: thanks but am new new emacs/aquamacs. What you mean by M-p C-c C-l. Btw: am on OSX Cheers, Miro On Wed, Dec 11, 2013 at 9:46 AM, Mateusz Kowalczyk wrote: > On 11/12/13 08:40, Miro Karpis wrote: > > Hi, please,..... I have started to use aquamacs and their haskell > > interpreter. Only problem is that I don't know how to access interpreter > > commands history. Usually it would be key UP/DOWN, but that will move the > > cursor UP/DOWN. So,... please how can I access interpreter/console user > > commands history in aquamacs? > > > > Cheers, > > Miro > > > > > > > > _______________________________________________ > > Beginners mailing list > > Beginners at haskell.org > > http://www.haskell.org/mailman/listinfo/beginners > > > Try M-p. C-c C-l seems to bring up input history. > > -- > Mateusz K. > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mukeshtiwari.iiitm at gmail.com Wed Dec 11 09:10:28 2013 From: mukeshtiwari.iiitm at gmail.com (mukesh tiwari) Date: Wed, 11 Dec 2013 14:40:28 +0530 Subject: [Haskell-beginners] aquamacs - history interpreter In-Reply-To: References: <52A82649.1050908@fuuzetsu.co.uk> Message-ID: On Wed, Dec 11, 2013 at 2:30 PM, Miro Karpis wrote: > thanks but am new new emacs/aquamacs. What you mean by M-p C-c C-l. > Btw: am on OSX > I think M should be the Escape ( M-p is Escape followed by p ), C is control ( C-c is controlled followed by c ). > Cheers, > Miro > > > On Wed, Dec 11, 2013 at 9:46 AM, Mateusz Kowalczyk < > fuuzetsu at fuuzetsu.co.uk> wrote: > >> On 11/12/13 08:40, Miro Karpis wrote: >> > Hi, please,..... I have started to use aquamacs and their haskell >> > interpreter. Only problem is that I don't know how to access interpreter >> > commands history. Usually it would be key UP/DOWN, but that will move >> the >> > cursor UP/DOWN. So,... please how can I access interpreter/console user >> > commands history in aquamacs? >> > >> > Cheers, >> > Miro >> > >> > >> > >> > _______________________________________________ >> > Beginners mailing list >> > Beginners at haskell.org >> > http://www.haskell.org/mailman/listinfo/beginners >> > >> Try M-p. C-c C-l seems to bring up input history. >> >> -- >> Mateusz K. >> _______________________________________________ >> 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 miroslav.karpis at gmail.com Wed Dec 11 09:22:10 2013 From: miroslav.karpis at gmail.com (Miro Karpis) Date: Wed, 11 Dec 2013 10:22:10 +0100 Subject: [Haskell-beginners] aquamacs - history interpreter In-Reply-To: References: <52A82649.1050908@fuuzetsu.co.uk> Message-ID: many thanks: it actually is M-p (cursor up) and M-n (cursor down) found it here: http://www.stephenwalker.com/notes/aquamacsemacs-key-binding-list/ m. On Wed, Dec 11, 2013 at 10:10 AM, mukesh tiwari < mukeshtiwari.iiitm at gmail.com> wrote: > > > > On Wed, Dec 11, 2013 at 2:30 PM, Miro Karpis wrote: > >> thanks but am new new emacs/aquamacs. What you mean by M-p C-c C-l. >> Btw: am on OSX >> > > I think M should be the Escape ( M-p is Escape followed by p ), C is > control ( C-c is controlled followed by c ). > > >> Cheers, >> Miro >> >> >> On Wed, Dec 11, 2013 at 9:46 AM, Mateusz Kowalczyk < >> fuuzetsu at fuuzetsu.co.uk> wrote: >> >>> On 11/12/13 08:40, Miro Karpis wrote: >>> > Hi, please,..... I have started to use aquamacs and their haskell >>> > interpreter. Only problem is that I don't know how to access >>> interpreter >>> > commands history. Usually it would be key UP/DOWN, but that will move >>> the >>> > cursor UP/DOWN. So,... please how can I access interpreter/console user >>> > commands history in aquamacs? >>> > >>> > Cheers, >>> > Miro >>> > >>> > >>> > >>> > _______________________________________________ >>> > Beginners mailing list >>> > Beginners at haskell.org >>> > http://www.haskell.org/mailman/listinfo/beginners >>> > >>> Try M-p. C-c C-l seems to bring up input history. >>> >>> -- >>> Mateusz K. >>> _______________________________________________ >>> 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 miroslav.karpis at gmail.com Wed Dec 11 14:06:22 2013 From: miroslav.karpis at gmail.com (Miro Karpis) Date: Wed, 11 Dec 2013 15:06:22 +0100 Subject: [Haskell-beginners] autocomplete in haskell-aquamacs interpreter Message-ID: Please, is there a shortcut for autocomplete in aquamacs (for files and haskell functions)? Cheers, m. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jhenahan at uvm.edu Thu Dec 12 01:13:45 2013 From: jhenahan at uvm.edu (Jack Henahan) Date: Wed, 11 Dec 2013 20:13:45 -0500 Subject: [Haskell-beginners] setting up haskell-mode in gnu-emacs (OSX) In-Reply-To: References: Message-ID: <8F46F32A-C5AF-426B-8696-E90102266878@uvm.edu> You might not have the right package archive available. Try M-x package-list-packages And then see if haskell-mode is listed. If not, you?ll need to add require 'package) (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/" )) (package-initialize) to your .emacs (or the equivalent statement for MELPA). On Dec 10, 2013, at 1:19 AM, Miro Karpis wrote: > Thanks, > > now I'm getting "Install package: haskell-mode[No match]". I'm doing this via gnu-emacs in OSX > > Do I need to download the package and place it somewhere? > > Thanks, > m. > > > On Tue, Dec 10, 2013 at 6:27 AM, Brandon Allbery wrote: > On Tue, Dec 10, 2013 at 12:13 AM, Miro Karpis wrote: > I'm having troubles to set-up haskell-mode in gnu-emacs. I'm new to emacs,... > Instructions says: via package manager add: M-x package-install haskell-mode > I can open package manager, but where should I paste the command? > > That's not really pasteable as such. > > M-x refers to pressing Meta-x (for a terminal this may not be available without special configuration) or Esc followed by x. is the Return key. > > So: press Esc, x (minibuffer shows "M-x "), type "package-install", press Return, type "haskell-mode", press Return. (If you have configured Terminal to use Option for Meta --- this is not default as it disables internationalization --- then you can press Option-x instead of Esc followed by x.) > > -- > 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 -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 842 bytes Desc: Message signed with OpenPGP using GPGMail URL: From jhenahan at uvm.edu Thu Dec 12 01:19:01 2013 From: jhenahan at uvm.edu (Jack Henahan) Date: Wed, 11 Dec 2013 20:19:01 -0500 Subject: [Haskell-beginners] Cabal build dependency using a git repo In-Reply-To: References: <87a9g9lmvw.fsf@pmade.com> <87siu0k8x8.fsf@pmade.com> Message-ID: I honestly recommend a sandbox. That is exactly the scenario they are used in, and there is no effect on your users since it?s just a local development concern. On Dec 10, 2013, at 10:55 AM, Michael Baker wrote: > Ok, I'll try that. Thanks. > > > On Tue, Dec 10, 2013 at 9:44 AM, Peter Jones wrote: > Michael Baker writes: > > On Mon, Dec 9, 2013 at 3:45 PM, Peter Jones wrote: > >> > >> Michael Baker writes: > >> > I have a library which isn't on Hackage that I would like to use as a > > build > >> > dependency in another project. In Rubygems you can provide a git > > repository > >> > in the absence of an actual Rubygems repository. > >> > >> Use a git submodule (or place the source code to the package anywhere on > >> your file system) then use `cabal sandbox add-source `. Provided > >> of course that you're using cabal sandboxes. > > > > What is commonly done if you aren't using sandboxes? I would rather > > not use them in an effort to make installing this project easier on my > > users, because the current Haskell Platform doesn't have sandboxes > > yet. > > I believe it's possible to run your own installation of the Hackage > server or at least host packages on a web server under a specific > directory structure. You can then configure cabal to fetch packages > from your private Hackage mirror. Then you just host your private > packages and any necessary public packages. More details: > > http://comonad.com/reader/2012/hackage-mirror/ > > -- > Peter Jones, Founder, Devalot.com > Defending the honor of good code > > _______________________________________________ > 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 -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 842 bytes Desc: Message signed with OpenPGP using GPGMail URL: From habari.zerglings at gmail.com Fri Dec 13 15:25:03 2013 From: habari.zerglings at gmail.com (Matt R) Date: Fri, 13 Dec 2013 15:25:03 +0000 Subject: [Haskell-beginners] Constrained polymorphic functions as natural transformations In-Reply-To: <20131114135911.GA31874@seas.upenn.edu> References: <20131114135911.GA31874@seas.upenn.edu> Message-ID: Hi Brent, Many thanks for taking the time to have a look! Hope you might be able to cope with some more amateurish fumbling as I try and expand my understanding... On 14 November 2013 13:59, Brent Yorgey wrote: > In general one must consider what are called > *di*natural transformations. (I ought to write a blog post about > this.)...but I thought I would mention it in case you want to look it up > later. Thanks -- dinatural transformations are probably a bit beyond my comfort zone right now, but I'll add it to my list of things to look at. Interesting to discover that not all polymorphic functions are natural transformations. "fix" seems rather exotic -- are there any less unusual examples? Note that you can't always characterize a type class by a single > function like this. For example, consider class Foo ... There is no way > to pick functors f and g such that a Foo dictionary is > equivalent to f a -> g a. > I was wondering why the following wouldn't do the trick? sig :: Foo a => Either Int a -> Either a Int sig (Left n) = Left (bar n) sig (Right a) = Right (baz a) > This doesn't really make sense. If a natural transformation > consists of a family of arrows which all live in Hask_T, In this case, I think the family of arrows lives in Hask -- we can reinterpret our Hask endofunctors as instead being functors from Hask_T -> Hask. Then there's no requirement on our constrained polymorphic functions to commute with sig. In your example function f, the two functors would be the identify functor "Id" and a constant functor "K Foo", and naturality is just saying that, for any function g: A -> B that satisfies show == show . f, then: f = f . g Which is clearly true for f. Am I still barking up the wrong tree? Apologies if so, but it *feels* like there should be something here, with the intuition that: Functions that don't "inspect" their values ==> you can substitute values without fundamentally affecting the action of the function ==> natural transformations between Hask endofunctors. Functions that don't inspect their values other than through a particular interface T ==> you can substitute values without fundamentally affecting the action of the function, providing your substitution is invisible through the interface T ==> Natural transformations between functors Hask_T -> Hask. -- Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: From ky3 at atamo.com Fri Dec 13 18:55:08 2013 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Sat, 14 Dec 2013 01:55:08 +0700 Subject: [Haskell-beginners] Constrained polymorphic functions as natural transformations In-Reply-To: References: <20131114135911.GA31874@seas.upenn.edu> Message-ID: On Fri, Dec 13, 2013 at 10:25 PM, Matt R wrote: > Interesting to discover that not all polymorphic functions are natural > transformations. "fix" seems rather exotic -- are there any less unusual > examples? None of the church numerals of type (a -> a) -> (a -> a) are natural transformations either: zero _ = id one f = f two f = f . f three f = f . f . f etc. -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew.fleckenstein at gmail.com Fri Dec 13 21:03:23 2013 From: andrew.fleckenstein at gmail.com (Andrew Fleckenstein) Date: Fri, 13 Dec 2013 16:03:23 -0500 Subject: [Haskell-beginners] Error with floats in implementation of Horner's method. Message-ID: Hi all, I have implemented Horner's method for evaluating a polynomial as follows: -- the nth horner element, given a list of coefficients and a value at which it needs to be evaluated horner_element l x n | n == (length l)-1 = last l | otherwise = (l !! n) + (horner_element l x (n+1))*x -- compute a polynomial given as a list of coefficients at the value x using horner's method. horner l x = horner_element l x 0 -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew.fleckenstein at gmail.com Fri Dec 13 21:07:42 2013 From: andrew.fleckenstein at gmail.com (Andrew Fleckenstein) Date: Fri, 13 Dec 2013 16:07:42 -0500 Subject: [Haskell-beginners] Error with floats in implementation of Horner's method. In-Reply-To: References: Message-ID: And I have sent the email before it was finished, oops. Evaluating at integer values works fine, but trying to do *Main> let a = [-1,2,-6,2] *Main> horner a 1.23 gives this error :4:10: No instance for (Fractional Integer) arising from the literal `1.23' Possible fix: add an instance declaration for (Fractional Integer) In the second argument of `horner', namely `1.23' In the expression: horner a 1.23 In an equation for `it': it = horner a 1.23 I know it has something to do with types, but whenever I try to add a type signature to the functions it just messes everything up even more. Any help would be appreciated Thanks, Andrew On Fri, Dec 13, 2013 at 4:03 PM, Andrew Fleckenstein < andrew.fleckenstein at gmail.com> wrote: > Hi all, > > I have implemented Horner's method for evaluating a polynomial as follows: > > -- the nth horner element, given a list of coefficients and a value at > which it needs to be evaluated > > horner_element l x n > | n == (length l)-1 = last l > | otherwise = (l !! n) + (horner_element l x (n+1))*x > > -- compute a polynomial given as a list of coefficients at the value x > using horner's method. > > horner l x = horner_element l x 0 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ky3 at atamo.com Fri Dec 13 21:20:52 2013 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Sat, 14 Dec 2013 04:20:52 +0700 Subject: [Haskell-beginners] Error with floats in implementation of Horner's method. In-Reply-To: References: Message-ID: On Sat, Dec 14, 2013 at 4:07 AM, Andrew Fleckenstein < andrew.fleckenstein at gmail.com> wrote: > I know it has something to do with types, Right! :) > but whenever I try to add a type signature to the functions it just messes > everything up even more. This works: let a :: [Double]; a = [-1,2,-6,2] This works too: let a :: Num a => [a]; a = [-1,2,-6,2] What do you think are the pros and cons of either? -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew.fleckenstein at gmail.com Fri Dec 13 21:51:25 2013 From: andrew.fleckenstein at gmail.com (Andrew Fleckenstein) Date: Fri, 13 Dec 2013 16:51:25 -0500 Subject: [Haskell-beginners] Error with floats in implementation of Horner's method. In-Reply-To: References: Message-ID: I know Num is a class, and Double is an instance of the Num class. I guess using Num would make it more generic, but I don't see why either one would be better in this particular function. On Fri, Dec 13, 2013 at 4:20 PM, Kim-Ee Yeoh wrote: > > On Sat, Dec 14, 2013 at 4:07 AM, Andrew Fleckenstein < > andrew.fleckenstein at gmail.com> wrote: > >> I know it has something to do with types, > > > Right! :) > > >> but whenever I try to add a type signature to the functions it just >> messes everything up even more. > > > This works: let a :: [Double]; a = [-1,2,-6,2] > > This works too: let a :: Num a => [a]; a = [-1,2,-6,2] > > What do you think are the pros and cons of either? > > -- 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 byorgey at seas.upenn.edu Sat Dec 14 02:21:32 2013 From: byorgey at seas.upenn.edu (Brent Yorgey) Date: Fri, 13 Dec 2013 21:21:32 -0500 Subject: [Haskell-beginners] Error with floats in implementation of Horner's method. In-Reply-To: References: Message-ID: <20131214022132.GA17146@seas.upenn.edu> Right. The problem is that when you write let a = [1,2,3,4] at the GHCi prompt, the Evil Monomorphism Restriction forces it to have a monomorphic type, and GHCi picks [Integer]. I recommend that you turn off the Monomorphism Restriction, which you can do in one of the following ways: 1) Type :set -XNoMonomorphismRestriction at the GHCi prompt 2) Add :set -XNoMonomorphismRestriction to your ~/.ghci file. If you do the latter then you only have to do it once, and from then on the MR will always be turned off in GHCi. With the MR turned off, let cs = [1,2,3,4] will result in cs :: Num a => [a] which will work the way you expect. -Brent On Fri, Dec 13, 2013 at 04:51:25PM -0500, Andrew Fleckenstein wrote: > I know Num is a class, and Double is an instance of the Num class. I guess > using Num would make it more generic, but I don't see why either one would > be better in this particular function. > > > On Fri, Dec 13, 2013 at 4:20 PM, Kim-Ee Yeoh wrote: > > > > > On Sat, Dec 14, 2013 at 4:07 AM, Andrew Fleckenstein < > > andrew.fleckenstein at gmail.com> wrote: > > > >> I know it has something to do with types, > > > > > > Right! :) > > > > > >> but whenever I try to add a type signature to the functions it just > >> messes everything up even more. > > > > > > This works: let a :: [Double]; a = [-1,2,-6,2] > > > > This works too: let a :: Num a => [a]; a = [-1,2,-6,2] > > > > What do you think are the pros and cons of either? > > > > -- Kim-Ee > > > > _______________________________________________ > > 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 From voldermort at hotmail.com Mon Dec 16 20:19:39 2013 From: voldermort at hotmail.com (robert) Date: Mon, 16 Dec 2013 20:19:39 +0000 (UTC) Subject: [Haskell-beginners] strip --strip-unneeded on package libraries Message-ID: I've noticed that installed packages all have a large .a archive which can be shrunk by about 10% with strip --strip-unneeded. Is there any downside to stripping, and if not, why isn't it done by GHC when the package is installed? There's a (default) option for cabal-install to strip executables, but it seems that package stripping has to be done manually, each time. From anguscomber at gmail.com Fri Dec 20 18:00:08 2013 From: anguscomber at gmail.com (Angus Comber) Date: Fri, 20 Dec 2013 18:00:08 +0000 Subject: [Haskell-beginners] Use of (n + 1) as parameter - is it more efficient? Message-ID: I created my own drop' function like this: drop' :: Int -> [a] -> [a] drop' 0 xs = xs drop' n [] = [] drop' n (x:xs) = drop' (n - 1) xs But in the Haskell book I am reading it is written like this: drop' :: Int -> [a] -> [a] drop' 0 xs = xs drop' (n + 1) [] = [] drop' (n + 1) (x:xs) = drop' n xs My version seems to work but I am concerned about my third line (drop' n [] = []). Is that a problem? Why does this author use n + 1 as a parameter as opposed to n - 1 like I do in body? Or does it make no difference? -------------- next part -------------- An HTML attachment was scrubbed... URL: From toad3k at gmail.com Fri Dec 20 18:20:12 2013 From: toad3k at gmail.com (David McBride) Date: Fri, 20 Dec 2013 13:20:12 -0500 Subject: [Haskell-beginners] Use of (n + 1) as parameter - is it more efficient? In-Reply-To: References: Message-ID: n+k patterns is a concept that used to be common in haskell but was later determined to be a misfeature and now you have to explicitly enable it in ghc. It was kind of a fun thing that turned out not to be necessary. The way that you do it is the way that it is recommended now and the code generated should be identical. On Fri, Dec 20, 2013 at 1:00 PM, Angus Comber wrote: > I created my own drop' function like this: > > drop' :: Int -> [a] -> [a] > drop' 0 xs = xs > drop' n [] = [] > drop' n (x:xs) = drop' (n - 1) xs > > > But in the Haskell book I am reading it is written like this: > > drop' :: Int -> [a] -> [a] > drop' 0 xs = xs > drop' (n + 1) [] = [] > drop' (n + 1) (x:xs) = drop' n xs > > My version seems to work but I am concerned about my third line (drop' n > [] = []). Is that a problem? > > Why does this author use n + 1 as a parameter as opposed to n - 1 like I > do in body? > > Or does it make no difference? > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vikraman.choudhury at gmail.com Fri Dec 20 18:25:25 2013 From: vikraman.choudhury at gmail.com (Vikraman) Date: Fri, 20 Dec 2013 23:55:25 +0530 Subject: [Haskell-beginners] Use of (n + 1) as parameter - is it more efficient? In-Reply-To: References: Message-ID: <20131220182525.GA25506@felicia.cse.iitk.ac.in> On Fri, Dec 20, 2013 at 06:00:08PM +0000, Angus Comber wrote: > I created my own drop' function like this: > > drop' :: Int -> [a] -> [a] > drop' 0 xs = xs > drop' n [] = [] > drop' n (x:xs) = drop' (n - 1) xs > > > But in the Haskell book I am reading it is written like this: > > drop' :: Int -> [a] -> [a] > drop' 0 xs = xs > drop' (n + 1) [] = [] > drop' (n + 1) (x:xs) = drop' n xs > > My version seems to work but I am concerned about my third line (drop' n [] > = []). Is that a problem? > > Why does this author use n + 1 as a parameter as opposed to n - 1 like I do > in body? > > Or does it make no difference? Using (n + 1) in the pattern match will cause the match to fail for negative numbers. But this would also need NPlusKPatterns. Note that in your implementation, negative values will result in an empty list, which is different from the GHC.List version. drop n xs | n <= 0 = xs drop _ [] = [] drop n (_:xs) = drop (n-1) xs You can easily find this out using quickcheck. ?> quickCheck $ \n xs -> drop' n xs == drop n xs -- Vikraman -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 230 bytes Desc: PGP signature URL: From voldermort at hotmail.com Sun Dec 22 14:38:53 2013 From: voldermort at hotmail.com (harry) Date: Sun, 22 Dec 2013 14:38:53 +0000 (UTC) Subject: [Haskell-beginners] retreive a list of installed packages Message-ID: Is there any simple way for a program to retrieve a list of installed packages (such as ghc-pkg list returns), or would it be easier to execute phc-pkg as an external process and catch the output? From kmandpjlynch at verizon.net Sun Dec 22 17:23:42 2013 From: kmandpjlynch at verizon.net (Patrick Lynch) Date: Sun, 22 Dec 2013 12:23:42 -0500 Subject: [Haskell-beginners] Is Cons in the Haskell Module Library Message-ID: <869634CA9D1B4FF2A8ED6BB20D4A013E@UserPC> Good morning, I'm going through Graham Hutton's link on Category Theory [and yes I understand that you needn't study CT in order to use Haskell] and he uses Cons. I realize that Cons may be a synonym for ':'. But can someone tell me how to search the Haskell Library to find the module containing Cons? Thank you and Merry Christmas -------------- next part -------------- An HTML attachment was scrubbed... URL: From nadirsampaoli at gmail.com Sun Dec 22 17:38:45 2013 From: nadirsampaoli at gmail.com (Nadir Sampaoli) Date: Sun, 22 Dec 2013 18:38:45 +0100 Subject: [Haskell-beginners] Is Cons in the Haskell Module Library In-Reply-To: <869634CA9D1B4FF2A8ED6BB20D4A013E@UserPC> References: <869634CA9D1B4FF2A8ED6BB20D4A013E@UserPC> Message-ID: Hello Patrick, > But can someone tell me how to search the Haskell Library to find the module > containing Cons? I (sadly) know nothing about Category Theory, so I probably am missing something, but when I'm looking for the module where a function or data type belongs to, I usually use Hoogle: http://www.haskell.org/hoogle/ (there's a hoogle command-line tool too). Is it what you're after? On a side note I tend to assimilate lisp's cons to Haskell's (:) too. I wouldn't mind if someone corrects this view of mine in case it's not correct :) Regards, Nadir From vikraman.choudhury at gmail.com Sun Dec 22 17:40:47 2013 From: vikraman.choudhury at gmail.com (Vikraman) Date: Sun, 22 Dec 2013 23:10:47 +0530 Subject: [Haskell-beginners] Is Cons in the Haskell Module Library In-Reply-To: <869634CA9D1B4FF2A8ED6BB20D4A013E@UserPC> References: <869634CA9D1B4FF2A8ED6BB20D4A013E@UserPC> Message-ID: <20131222174047.GA13334@felicia.cse.iitk.ac.in> On Sun, Dec 22, 2013 at 12:23:42PM -0500, Patrick Lynch wrote: > Good morning, > I'm going through Graham Hutton's link on Category Theory [and yes I understand that you needn't study CT in order to use Haskell] and he uses Cons. > I realize that Cons may be a synonym for ':'. > But can someone tell me how to search the Haskell Library to find the module containing Cons? > Thank you and Merry Christmas Cons is (:) and is defined in GHC.Types. ?> :i (:) data [] a = ... | a : [a] -- Defined in `GHC.Types' infixr 5 : You could also try hoogle. http://www.haskell.org/hoogle/?hoogle=cons -- Vikraman -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 230 bytes Desc: PGP signature URL: From allbery.b at gmail.com Sun Dec 22 17:51:13 2013 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 22 Dec 2013 12:51:13 -0500 Subject: [Haskell-beginners] Is Cons in the Haskell Module Library In-Reply-To: <869634CA9D1B4FF2A8ED6BB20D4A013E@UserPC> References: <869634CA9D1B4FF2A8ED6BB20D4A013E@UserPC> Message-ID: On Sun, Dec 22, 2013 at 12:23 PM, Patrick Lynch wrote: > Good morning, > I'm going through Graham Hutton's link on Category Theory [and yes I > understand that you needn't study CT in order to use Haskell] and he uses > Cons. > I realize that Cons may be a synonym for ':'. > But can someone tell me how to search the Haskell Library to find the > module containing Cons? > The usual point of Cons is that it's instructive to reconstruct the list type from first principles. You would never do this in a real program, since it's exactly the same as the built-in list type --- except that it doesn't come with all the predefined list stuff, so it's easier for you to build it yourself without interfering with (or being interfered with by!) the standard library. It also doesn't come with the convenient syntactic sugar. And even if for some reason you did need to restrict lists that way in a real program, you would probably use a newtype instead so that you can still use the standard list operations and syntax after unwrapping. data List a = Nil | Cons a (List a) data [] a = [] | (:) a ([] a) -- the builtin list type, for comparison -- 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 byorgey at seas.upenn.edu Sun Dec 22 20:26:50 2013 From: byorgey at seas.upenn.edu (Brent Yorgey) Date: Sun, 22 Dec 2013 15:26:50 -0500 Subject: [Haskell-beginners] Constrained polymorphic functions as natural transformations In-Reply-To: References: <20131114135911.GA31874@seas.upenn.edu> Message-ID: <20131222202650.GA32404@seas.upenn.edu> Hi Matt, On Fri, Dec 13, 2013 at 03:25:03PM +0000, Matt R wrote: > > Note that you can't always characterize a type class by a single > > function like this. For example, consider class Foo ... There is no way > > to pick functors f and g such that a Foo dictionary is > > equivalent to f a -> g a. > > > > I was wondering why the following wouldn't do the trick? > > sig :: Foo a => Either Int a -> Either a Int > sig (Left n) = Left (bar n) > sig (Right a) = Right (baz a) You have encoded a Foo dictionary as an Either Int a -> Either a Int function, but that is very different than saying that having a Foo dictionary is *equivalent* to having an Either Int a -> Either a Int function. They are not equivalent; in particular, you could have a function which sends Left 5 to Right 6, which does not correpond to anything in Foo. Put another way, if you try to write a Foo instance given only some unknown function of type (Either Int a -> Either a Int), you will find that you cannot do it. So my point stands that it is not always possible to *characterize* a type class as a natural transformation. > > This doesn't really make sense. If a natural transformation > > consists of a family of arrows which all live in Hask_T, > > > In this case, I think the family of arrows lives in Hask -- we can > reinterpret our Hask endofunctors as instead being functors from Hask_T -> > Hask. Then there's no requirement on our constrained polymorphic functions > to commute with sig. > > In your example function f, the two functors would be the identify functor > "Id" and a constant functor "K Foo", and naturality is just saying that, > for any function g: A -> B that satisfies show == show . f, then: > > f = f . g > > Which is clearly true for f. Hmm, yes, this seems plausible. > Am I still barking up the wrong tree? Apologies if so, but it *feels* like > there should be something here, with the intuition that: > > Functions that don't "inspect" their values ==> you can substitute values > without fundamentally affecting the action of the function ==> natural > transformations between Hask endofunctors. > > Functions that don't inspect their values other than through a particular > interface T ==> you can substitute values without fundamentally affecting > the action of the function, providing your substitution is invisible > through the interface T ==> Natural transformations between functors Hask_T > -> Hask. Yes, makes sense I think. -Brent From byorgey at seas.upenn.edu Sun Dec 22 20:35:24 2013 From: byorgey at seas.upenn.edu (Brent Yorgey) Date: Sun, 22 Dec 2013 15:35:24 -0500 Subject: [Haskell-beginners] retreive a list of installed packages In-Reply-To: References: Message-ID: <20131222203524.GB32404@seas.upenn.edu> On Sun, Dec 22, 2013 at 02:38:53PM +0000, harry wrote: > Is there any simple way for a program to retrieve a list of installed > packages (such as ghc-pkg list returns), or would it be easier to execute > phc-pkg as an external process and catch the output? Try the hackage-db package: http://hackage.haskell.org/package/hackage%2Ddb -Brent From byorgey at seas.upenn.edu Sun Dec 22 20:38:42 2013 From: byorgey at seas.upenn.edu (Brent Yorgey) Date: Sun, 22 Dec 2013 15:38:42 -0500 Subject: [Haskell-beginners] Is Cons in the Haskell Module Library In-Reply-To: <869634CA9D1B4FF2A8ED6BB20D4A013E@UserPC> References: <869634CA9D1B4FF2A8ED6BB20D4A013E@UserPC> Message-ID: <20131222203842.GC32404@seas.upenn.edu> On Sun, Dec 22, 2013 at 12:23:42PM -0500, Patrick Lynch wrote: > Good morning, > I'm going through Graham Hutton's link on Category Theory [and yes I understand that you needn't study CT in order to use Haskell] and he uses Cons. > I realize that Cons may be a synonym for ':'. > But can someone tell me how to search the Haskell Library to find the module containing Cons? > Thank you and Merry Christmas Are you asking how to find the definition of (:) in Haskell? (It is special built-in syntax.) Or are you asking how to find out what Graham Hutton means by 'Cons'? In the latter case, you will have to tell us exactly where in his notes to look, because out of context it is impossible to tell. -Brent From vikraman.choudhury at gmail.com Sun Dec 22 20:54:47 2013 From: vikraman.choudhury at gmail.com (Vikraman) Date: Mon, 23 Dec 2013 02:24:47 +0530 Subject: [Haskell-beginners] Is Cons in the Haskell Module Library In-Reply-To: <20131222203842.GC32404@seas.upenn.edu> References: <869634CA9D1B4FF2A8ED6BB20D4A013E@UserPC> <20131222203842.GC32404@seas.upenn.edu> Message-ID: <20131222205447.GA6620@felicia.cse.iitk.ac.in> On Sun, Dec 22, 2013 at 03:38:42PM -0500, Brent Yorgey wrote: > On Sun, Dec 22, 2013 at 12:23:42PM -0500, Patrick Lynch wrote: > > Good morning, > > I'm going through Graham Hutton's link on Category Theory [and yes I understand that you needn't study CT in order to use Haskell] and he uses Cons. > > I realize that Cons may be a synonym for ':'. > > But can someone tell me how to search the Haskell Library to find the module containing Cons? > > Thank you and Merry Christmas > > Are you asking how to find the definition of (:) in Haskell? (It is > special built-in syntax.) Or are you asking how to find out what > Graham Hutton means by 'Cons'? In the latter case, you will have to > tell us exactly where in his notes to look, because out of context it > is impossible to tell. > Probably this one, page 4. http://www.cs.nott.ac.uk/~gmh/cat2.pdf -- Vikraman From anguscomber at gmail.com Mon Dec 23 13:55:12 2013 From: anguscomber at gmail.com (Angus Comber) Date: Mon, 23 Dec 2013 13:55:12 +0000 Subject: [Haskell-beginners] Question on : usage Message-ID: I am playing with concatenating lists so I start with this: testconcat :: [[a]] -> [a] testconcat [[]] = [] testconcat [(x:xs)] = x : xs Now, testconcat [[]] and testconcat [[1,2]] works So now I want to try with a 2nd inner list so I do this: testconcat :: [[a]] -> [a] testconcat [[]] = [] testconcat [(x:xs)] = x : xs testconcat [(x:xs), (y:ys)] = x : xs : y : ys and I get load error: Couldn't match expected type `a' with actual type `[a]' `a' is a rigid type variable bound by the type signature for testconcat :: [[a]] -> [a] at prog_haskell.hs:218:15 In the first argument of `(:)', namely `xs' In the second argument of `(:)', namely `xs : y : ys' In the expression: x : xs : y : ys But this loads ok: testconcat :: [[a]] -> [a] testconcat [[]] = [] testconcat [(x:xs)] = x : xs testconcat [(x:xs), (y:ys)] = x : xs Even this line cannot be loaded: testconcat [(x:xs), (y:ys)] = x : xs : [] Couldn't match expected type `a' with actual type `[a]' `a' is a rigid type variable bound by the type signature for testconcat :: [[a]] -> [a] at prog_haskell.hs:218:15 In the first argument of `(:)', namely `xs' In the second argument of `(:)', namely `xs : []' In the expression: x : xs : [] Failed, modules loaded: none. if x : xs works why not x : xs : ??? Can someone please explain? -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Mon Dec 23 14:03:46 2013 From: allbery.b at gmail.com (Brandon Allbery) Date: Mon, 23 Dec 2013 09:03:46 -0500 Subject: [Haskell-beginners] Question on : usage In-Reply-To: References: Message-ID: On Mon, Dec 23, 2013 at 8:55 AM, Angus Comber wrote: > Couldn't match expected type `a' with actual type `[a]' > `a' is a rigid type variable bound by > the type signature for testconcat :: [[a]] -> [a] > at prog_haskell.hs:218:15 > In the first argument of `(:)', namely `xs' > In the second argument of `(:)', namely `xs : []' > In the expression: x : xs : [] > Failed, modules loaded: none. > > if x : xs works why not x : xs : ??? > x is an element. xs is a list of those elements. x : xs prepends a single element to a list. x : xs : y would attempt to prepend a single element *and* a list to something else --- but if you deconstructed a list to get x and xs, then x and xs are not the same type (since xs's type is that of a list of x). Perhaps the thing to understand is that in Haskell, a list is built up of elements all of the same type using (:): [x,y,z] is the same as x : y : z : [] (If you're familiar with Lisp, (:) is exactly cons and [] is nil.) But because Haskell is strictly typed, a list must contain elements all the same type. So you can't have y in that be a list of the same type as x, it must be a value the same type as x. Maybe you are looking for (++) instead? But note that that takes lists, not items, so it would have to be ([x] ++ xs ++ ...). -- 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 akaberto at gmail.com Mon Dec 23 14:05:54 2013 From: akaberto at gmail.com (akash g) Date: Mon, 23 Dec 2013 19:35:54 +0530 Subject: [Haskell-beginners] Question on : usage In-Reply-To: References: Message-ID: Because the type of cons (:) is a -> [a] -> [a]. Thus, when you do list : something else, you get a type mismatch. You are basically giving it [a] -> [a] -> [a]. You got yourself a type violation. On Mon, Dec 23, 2013 at 7:25 PM, Angus Comber wrote: > I am playing with concatenating lists so I start with this: > > testconcat :: [[a]] -> [a] > testconcat [[]] = [] > testconcat [(x:xs)] = x : xs > > Now, testconcat [[]] and testconcat [[1,2]] works > > So now I want to try with a 2nd inner list so I do this: > > testconcat :: [[a]] -> [a] > testconcat [[]] = [] > testconcat [(x:xs)] = x : xs > testconcat [(x:xs), (y:ys)] = x : xs : y : ys > > and I get load error: > Couldn't match expected type `a' with actual type `[a]' > `a' is a rigid type variable bound by > the type signature for testconcat :: [[a]] -> [a] > at prog_haskell.hs:218:15 > In the first argument of `(:)', namely `xs' > In the second argument of `(:)', namely `xs : y : ys' > In the expression: x : xs : y : ys > > > But this loads ok: > testconcat :: [[a]] -> [a] > testconcat [[]] = [] > testconcat [(x:xs)] = x : xs > testconcat [(x:xs), (y:ys)] = x : xs > > Even this line cannot be loaded: > testconcat [(x:xs), (y:ys)] = x : xs : [] > > Couldn't match expected type `a' with actual type `[a]' > `a' is a rigid type variable bound by > the type signature for testconcat :: [[a]] -> [a] > at prog_haskell.hs:218:15 > In the first argument of `(:)', namely `xs' > In the second argument of `(:)', namely `xs : []' > In the expression: x : xs : [] > Failed, modules loaded: none. > > if x : xs works why not x : xs : ??? > > Can someone please explain? > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.trstenjak at gmail.com Mon Dec 23 14:11:08 2013 From: daniel.trstenjak at gmail.com (Daniel Trstenjak) Date: Mon, 23 Dec 2013 15:11:08 +0100 Subject: [Haskell-beginners] Question on : usage In-Reply-To: References: Message-ID: <20131223141108.GA10571@machine> Hi Angus, > testconcat [(x:xs), (y:ys)] = x : xs : y : ys When you're replacing the x, xs, y, and ys with types you're getting: a : [a] : a : [a] The type of (:) is: a -> [a] -> [a] Can you see the problem? Hint, the problem is the (:) in the middle. Greetings, Daniel From michael at orlitzky.com Mon Dec 23 14:12:25 2013 From: michael at orlitzky.com (Michael Orlitzky) Date: Mon, 23 Dec 2013 09:12:25 -0500 Subject: [Haskell-beginners] Question on : usage In-Reply-To: References: Message-ID: <52B844C9.4090705@orlitzky.com> On 12/23/2013 08:55 AM, Angus Comber wrote: > I am playing with concatenating lists so I start with this: > > testconcat :: [[a]] -> [a] > testconcat [[]] = [] > testconcat [(x:xs)] = x : xs > > Now, testconcat [[]] and testconcat [[1,2]] works > > So now I want to try with a 2nd inner list so I do this: > > testconcat :: [[a]] -> [a] > testconcat [[]] = [] > testconcat [(x:xs)] = x : xs > testconcat [(x:xs), (y:ys)] = x : xs : y : ys > > and I get load error: > Couldn't match expected type `a' with actual type `[a]' > `a' is a rigid type variable bound by > the type signature for testconcat :: [[a]] -> [a] > at prog_haskell.hs:218:15 > In the first argument of `(:)', namely `xs' > In the second argument of `(:)', namely `xs : y : ys' > In the expression: x : xs : y : ys > The colon operator (:) takes a single element on the left, and a list on the right. In, testconcat [(x:xs), (y:ys)] = x : xs : y : ys you've got lists on both the left and the right. This would work: testconcat [(x:xs), (y:ys)] = x : ( y : (xs ++ ys) ) (note: not the same function as you wanted!) since it keeps all of the single-elements on the left-hand side of (:). You're going to need to use (++) in at least one place, though, since you need to combine the lists 'xs' and 'ys' somehow. The function you really want is, testconcat [(x:xs), (y:ys)] = (x:xs) ++ (y:ys) but of course this is just, testconcat [l1, l2] = l1 ++ l2 From anguscomber at gmail.com Mon Dec 23 14:57:35 2013 From: anguscomber at gmail.com (Angus Comber) Date: Mon, 23 Dec 2013 14:57:35 +0000 Subject: [Haskell-beginners] Question on (x:xs) form Message-ID: Eg for a definition of reverse: reverse' :: [a] -> [a] reverse' [] = [] reverse' (x:xs) = reverse' xs ++ [x] In the last line of the definition, x is an element in the list (the first element) and xs represents the remainder of the list. so if list was [1,2,3] then x is 1 and xs is [2,3] Why are the brackets required? And what do they signify? Eg reverse' x:xs = reverse' xs ++ [x] results in a parse error. -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Mon Dec 23 15:03:26 2013 From: allbery.b at gmail.com (Brandon Allbery) Date: Mon, 23 Dec 2013 10:03:26 -0500 Subject: [Haskell-beginners] Question on (x:xs) form In-Reply-To: References: Message-ID: On Mon, Dec 23, 2013 at 9:57 AM, Angus Comber wrote: > Why are the brackets required? And what do they signify? > Eg reverse' x:xs = reverse' xs ++ [x] results in a parse error. > If you leave them off then it's parsed as three parameters instead of a pattern as a single parameter. But that also leads to a parse error since you can't use a bare operator that way. Which is "weird", but you can get into inconsistent parses if you try to guess that the parentheses are needed: should it be `(x:xs)` a pattern, or should it be `x (:) xs` 3 patterns with an infix constructor as the second? -- 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 Dec 23 15:56:24 2013 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Mon, 23 Dec 2013 22:56:24 +0700 Subject: [Haskell-beginners] Question on (x:xs) form In-Reply-To: References: Message-ID: On Mon, Dec 23, 2013 at 9:57 PM, Angus Comber wrote: > Why are the brackets required? And what do they signify? > > Eg reverse' x:xs = reverse' xs ++ [x] results in a parse error. > So a number of Haskell-specific themes are relevant here, especially if you come from a Lisp background: * types (but you knew that already!) * pattern-matching & exhaustivity of matches * operator infix notation * associativity precedence * special notation for lists It's a good idea to watch out for all of the above when learning the language. It helps to have some google-able names when the situation is ripe for drilling deep into these topics. To elaborate a bit, Special List Notation: lists use (:) and [x]. But this syntax is baked specially into the language definition! If you define your own list, it'll typically look like data List a = Nil | Cons a (List a) -- note the parens! The alternative GADT-ish style may make this clearer: data List a where Nil :: List a Cons :: a -> List a -> List a Nil and Cons are data constructor *functions*, and because and only because they are so, do they get to have Capitalized Names. <------- this is another big WTF that trips up many, many learners. Especially with code like: newtype X a = X a -- whaaaa????? (It's ok, you'll get it soon enough.) Back to reverse'. With our user-defined List a, reverse' will look like reverse' Nil = reverse' (Cons x xs) = ... -- again note the parens! (There is however, *NO* difference in the semantics. The code just looks different but the compiler doesn't care.) Note how the pattern-matching includes every single case of the sum-type; here both of them: Nil and Cons. This is Generally A Good Thing! -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From denisalbuquerque at gmail.com Mon Dec 23 18:55:35 2013 From: denisalbuquerque at gmail.com (Denis Albuquerque) Date: Mon, 23 Dec 2013 16:55:35 -0200 Subject: [Haskell-beginners] Question on (x:xs) form In-Reply-To: References: Message-ID: Hi Angus, you need to put the parentheses around the pattern x:xs because the application reverse' has priority over (:) , so the statement is the same as (reverse' x):xs = reverse' xs ++ [x] and results the error. -- Denis. On Mon, Dec 23, 2013 at 12:57 PM, Angus Comber wrote: > Eg for a definition of reverse: > > reverse' :: [a] -> [a] > reverse' [] = [] > reverse' (x:xs) = reverse' xs ++ [x] > > In the last line of the definition, x is an element in the list (the first > element) and xs represents the remainder of the list. > > so if list was [1,2,3] then x is 1 and xs is [2,3] > > Why are the brackets required? And what do they signify? > > Eg reverse' x:xs = reverse' xs ++ [x] results in a parse error. > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > From miroslav.karpis at gmail.com Mon Dec 23 21:42:47 2013 From: miroslav.karpis at gmail.com (Miro Karpis) Date: Mon, 23 Dec 2013 22:42:47 +0100 Subject: [Haskell-beginners] breaking code to several lines Message-ID: Hi please,... I have one sql insert statement which is too long to be on one line. Is there a way that I can break it several lines? Or does it have to be everything in one line? here is the query: execute_ conn "INSERT INTO ttableXY (column1, column2, column3, column4, column5, column6, column7) VALUES ('var1', 'var2', 'var3', 'var4', 'var5', 'var6', 'var7')" Thanks, Miro -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Mon Dec 23 21:47:12 2013 From: allbery.b at gmail.com (Brandon Allbery) Date: Mon, 23 Dec 2013 16:47:12 -0500 Subject: [Haskell-beginners] breaking code to several lines In-Reply-To: References: Message-ID: On Mon, Dec 23, 2013 at 4:42 PM, Miro Karpis wrote: > Hi please,... I have one sql insert statement which is too long to be on > one line. Is there a way that I can break it several lines? Or does it have > to be everything in one line? > See "string gaps" in http://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-200002.6 -- 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 toad3k at gmail.com Mon Dec 23 21:57:48 2013 From: toad3k at gmail.com (David McBride) Date: Mon, 23 Dec 2013 16:57:48 -0500 Subject: [Haskell-beginners] breaking code to several lines In-Reply-To: References: Message-ID: Another option is a string quasiquoter. There are several options available, non interpolating ones ones such as string-qq or string-quote, as well as ones that allow you to interpolate variables, like interpolatedstring-qq. On Mon, Dec 23, 2013 at 4:42 PM, Miro Karpis wrote: > Hi please,... I have one sql insert statement which is too long to be on > one line. Is there a way that I can break it several lines? Or does it have > to be everything in one line? > > here is the query: > execute_ conn "INSERT INTO ttableXY > (column1, column2, column3, column4, column5, column6, column7) VALUES > ('var1', 'var2', 'var3', 'var4', 'var5', 'var6', 'var7')" > > Thanks, > Miro > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From miroslav.karpis at gmail.com Mon Dec 23 22:05:13 2013 From: miroslav.karpis at gmail.com (Miro Karpis) Date: Mon, 23 Dec 2013 23:05:13 +0100 Subject: [Haskell-beginners] breaking code to several lines In-Reply-To: References: Message-ID: thank you very much m. On Mon, Dec 23, 2013 at 10:57 PM, David McBride wrote: > Another option is a string quasiquoter. There are several options > available, non interpolating ones ones such as string-qq or string-quote, > as well as ones that allow you to interpolate variables, like > interpolatedstring-qq. > > > On Mon, Dec 23, 2013 at 4:42 PM, Miro Karpis wrote: > >> Hi please,... I have one sql insert statement which is too long to be on >> one line. Is there a way that I can break it several lines? Or does it have >> to be everything in one line? >> >> here is the query: >> execute_ conn "INSERT INTO ttableXY >> (column1, column2, column3, column4, column5, column6, column7) VALUES >> ('var1', 'var2', 'var3', 'var4', 'var5', 'var6', 'var7')" >> >> Thanks, >> Miro >> >> _______________________________________________ >> Beginners mailing list >> Beginners at haskell.org >> http://www.haskell.org/mailman/listinfo/beginners >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From miroslav.karpis at gmail.com Tue Dec 24 00:37:45 2013 From: miroslav.karpis at gmail.com (Miro Karpis) Date: Tue, 24 Dec 2013 01:37:45 +0100 Subject: [Haskell-beginners] Database.SQLite.Simple: Select query with more than 10 elements tuple Message-ID: Hi, please ... I need help with following: I have a table with 11 columns. I would like to create a query where in return I should get values of all columns. Problem is that when I try with 10 elements everything works OK. With 11 I will get compile error. I found in the Database.SQLite.Simple documentation following: A collection type that can be converted from a sequence of fields. Instances are provided for tuples up to 10 elements and lists of any length. So is it possible to select more than 10 columns in one query? It must be right? working code: ------------------------- queryX :: Query queryX = "SELECT el1, el2, el3, el4, el5, el6, el7, el8, el9, el10 FROM tableX" saveBtceTickerData :: IO () saveBtceTickerData = do conn <- open "../mydb.sqlite" r <- query_ conn queryX :: IO [(Double, Int, Double, Double, Double, Double, Double, Double, Double, Double)] mapM_ print r close conn putStrLn "done" non-working code: ------------------------- someQuery :: Query someQuery = "SELECT el1, el2, el3, el4, el5, el6, el7, el8, el9, el10, el11 FROM tableX" saveBtceTickerData :: IO () saveBtceTickerData = do conn <- open "../mydb.sqlite" r <- query_ conn queryX :: IO [(Double, Int, Double, Double, Double, Double, Double, Double, Double, Double, Double)] mapM_ print r close conn putStrLn "done" ------ Error output: No instance for (FromRow (Double, Int, Double, Double, Double, Double, Double, Double, Double, Double, Double)) arising from a use of `query_' Possible fix: add an instance declaration for (FromRow (Double, Int, Double, Double, Double, Double, Double, Double, Double, Double, Double)) thanks, m. -------------- next part -------------- An HTML attachment was scrubbed... URL: From toad3k at gmail.com Tue Dec 24 01:16:07 2013 From: toad3k at gmail.com (David McBride) Date: Mon, 23 Dec 2013 20:16:07 -0500 Subject: [Haskell-beginners] Database.SQLite.Simple: Select query with more than 10 elements tuple In-Reply-To: References: Message-ID: You can use the :. operator to separate different types. You can string them together for as long as you want. WIth ScopedTypeVariables extension enabled you can type them in an anon function like so. forM_ res $ \((Only (x :: Int)) :. (Only (y :: Int)) ) -> do print (show x) ++ (show y) You can also create your own 11+ item datatype and create a fromRow instance for it, which would serve the same purpose. On Mon, Dec 23, 2013 at 7:37 PM, Miro Karpis wrote: > Hi, please ... I need help with following: > > I have a table with 11 columns. I would like to create a query where in > return I should get values of all columns. Problem is that when I try with > 10 elements everything works OK. With 11 I will get compile error. > > I found in the Database.SQLite.Simple documentation following: > A collection type that can be converted from a sequence of fields. > Instances are provided for tuples up to 10 elements and lists of any length. > > So is it possible to select more than 10 columns in one query? It must be > right? > > > working code: > ------------------------- > queryX :: Query > queryX = "SELECT el1, el2, el3, el4, el5, el6, el7, el8, el9, el10 FROM > tableX" > > saveBtceTickerData :: IO () > saveBtceTickerData = do > conn <- open "../mydb.sqlite" > r <- query_ conn queryX :: IO [(Double, Int, Double, Double, Double, > Double, Double, Double, Double, Double)] > mapM_ print r > close conn > putStrLn "done" > > > non-working code: > ------------------------- > someQuery :: Query > someQuery = "SELECT el1, el2, el3, el4, el5, el6, el7, el8, el9, el10, > el11 FROM tableX" > > saveBtceTickerData :: IO () > saveBtceTickerData = do > conn <- open "../mydb.sqlite" > r <- query_ conn queryX :: IO [(Double, Int, Double, Double, Double, > Double, Double, Double, Double, Double, Double)] > mapM_ print r > close conn > putStrLn "done" > > ------ > Error output: > > No instance for (FromRow > > (Double, > > Int, > > Double, > > Double, > > Double, > > Double, > > Double, > > Double, > > Double, > > Double, > > Double)) > > arising from a use of `query_' > > Possible fix: > > add an instance declaration for > > (FromRow > > (Double, > > Int, > > Double, > > Double, > > Double, > > Double, > > Double, > > Double, > > Double, > > Double, > > Double)) > > > thanks, > m. > > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From anguscomber at gmail.com Tue Dec 24 13:19:42 2013 From: anguscomber at gmail.com (Angus Comber) Date: Tue, 24 Dec 2013 13:19:42 +0000 Subject: [Haskell-beginners] Trying to understand the foldl type? Message-ID: The type is: foldl :: (a -> b -> a) -> a -> [b] -> a Eg I might do something like this: foldl (+) 0 [1..10] so taking (a -> b -> a) leftmost a is (+) b is 0 right a is what? The first value in the list? Then -> ? [b] ? Is this like the temporary recursion calculation? final -> a is the result? -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob at redivi.com Tue Dec 24 13:47:23 2013 From: bob at redivi.com (Bob Ippolito) Date: Tue, 24 Dec 2013 05:47:23 -0800 Subject: [Haskell-beginners] Trying to understand the foldl type? In-Reply-To: References: Message-ID: Given foldl (+) 0 [1..10] (+) is (a -> b -> a) 0 is a [1..10] is [b] and the final a is the result of the expression. On Tuesday, December 24, 2013, Angus Comber wrote: > The type is: > > foldl :: (a -> b -> a) -> a -> [b] -> a > > Eg I might do something like this: > > foldl (+) 0 [1..10] > > so taking (a -> b -> a) > > leftmost a is (+) > b is 0 > right a is what? The first value in the list? > > Then -> ? > > [b] ? Is this like the temporary recursion calculation? > > final -> a is the result? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ky3 at atamo.com Tue Dec 24 15:21:52 2013 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Tue, 24 Dec 2013 22:21:52 +0700 Subject: [Haskell-beginners] Trying to understand the foldl type? In-Reply-To: References: Message-ID: On Tue, Dec 24, 2013 at 8:19 PM, Angus Comber wrote: > foldl :: (a -> b -> a) -> a -> [b] -> a > > Eg I might do something like this: > > foldl (+) 0 [1..10] > Try the following in ghci to see if you get an idea of what's going on: :t foldl :t foldl (+) :t foldl (+) 0 :t foldl (+) 0 [1..10] -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From guthrie at mum.edu Wed Dec 25 17:38:50 2013 From: guthrie at mum.edu (Gregory Guthrie) Date: Wed, 25 Dec 2013 11:38:50 -0600 Subject: [Haskell-beginners] OMG - Cabal again... Message-ID: <08EF9DA445C4B5439C4733E1F35705BA032C28CC8D97@MAIL.cs.mum.edu> YACP - Yet another cabal problem... Trying to install criterion, which fails for test-framework, which fails for regex, which fails for mtl, which reports that it is fine and installed! Is there any simple recipe to restart the libraries for cabal (on windows)? C:\Users\guthrie>cabal install criterion Resolving dependencies... In order, the following will be installed: ... criterion-0.8.0.0 depends on test-framework-0.8.0.3 which failed to install. hastache-0.5.1 failed during the building phase. The exception was: ExitFailure 1 math-functions-0.1.4.0 failed during the building phase. The exception was: ExitFailure 1 monad-par-0.3.4.6 depends on test-framework-0.8.0.3 which failed to install. monad-par-extras-0.3.3 failed during the building phase. The exception was: ExitFailure 1 mwc-random-0.13.1.0 failed during the building phase. The exception was: ExitFailure 1 statistics-0.10.5.1 depends on test-framework-0.8.0.3 which failed to install. test-framework-0.8.0.3 failed during the configure step. The exception was: ExitFailure 1 test-framework-hunit-0.3.0.1 depends on test-framework-0.8.0.3 which failed to install. vector-algorithms-0.6.0.1 depends on mwc-random-0.13.1.0 which failed to install. vector-binary-instances-0.2.1.0 failed during the building phase. The exception was: ExitFailure 1 C:\Users\guthrie>cabal install test-framework Resolving dependencies... Configuring test-framework-0.8.0.3... cabal: The following installed packages are broken because other packages they depend on are missing. These broken packages must be rebuilt before they can be used. package regex-base-0.93.2 is broken due to missing package mtl-2.1.2-5337caef659244e51e2f5fb2e944d97f Failed to install test-framework-0.8.0.3 cabal: Error: some packages failed to install: test-framework-0.8.0.3 failed during the configure step. The exception was: ExitFailure 1 C:\Users\guthrie>cabal install mtl Resolving dependencies... All the requested packages are already installed: mtl-2.1.2 Use --reinstall if you want to reinstall anyway. ------------------------------------------- Dr. Gregory Guthrie Computer Science Department Dean, and Professor of Computer Science School of Computer Science & Mathematics Maharishi University of Management ------------------------------------------- From voldermort at hotmail.com Sun Dec 29 12:17:20 2013 From: voldermort at hotmail.com (harry) Date: Sun, 29 Dec 2013 12:17:20 +0000 (UTC) Subject: [Haskell-beginners] anonymous arguments Message-ID: Is there any reason not to include Scala-like anonymous arguments in Haskell? For example, I would like to write map (\x -> foo x 3) as map (foo _ 3) The named argument in this and similar cases adds nothing but visual and namespace clutter. From tmorris at tmorris.net Sun Dec 29 12:37:51 2013 From: tmorris at tmorris.net (Tony Morris) Date: Sun, 29 Dec 2013 22:37:51 +1000 Subject: [Haskell-beginners] anonymous arguments In-Reply-To: References: Message-ID: (`foo` 3) Scala is very limited when it comes to this point free code. On 29/12/2013 10:17 PM, "harry" wrote: > Is there any reason not to include Scala-like anonymous arguments in > Haskell? For example, I would like to write > map (\x -> foo x 3) > as > map (foo _ 3) > > The named argument in this and similar cases adds nothing but visual and > namespace clutter. > > _______________________________________________ > 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 Sun Dec 29 12:47:48 2013 From: voldermort at hotmail.com (harry) Date: Sun, 29 Dec 2013 12:47:48 +0000 (UTC) Subject: [Haskell-beginners] anonymous arguments References: Message-ID: Tony Morris tmorris.net> writes: > > > (`foo` 3) > Scala is very limited when it comes to this point free code. > > On 29/12/2013 10:17 PM, "harry" hotmail.com> wrote: > > Is there any reason not to include Scala-like anonymous arguments in > Haskell? For example, I would like to write > ? map (\x -> foo x 3) > as > ? map (foo _ 3) > The named argument in this and similar cases adds nothing but visual and > namespace clutter. How about a slightly more complex example? map (\x -> foo 4 'f' (bar x) 5 'j') There comes a point where point-free notation becomes unreadable. From twanvl at gmail.com Sun Dec 29 13:24:13 2013 From: twanvl at gmail.com (Twan van Laarhoven) Date: Sun, 29 Dec 2013 14:24:13 +0100 Subject: [Haskell-beginners] anonymous arguments In-Reply-To: References: Message-ID: <52C0227D.2050108@gmail.com> On 2013-12-29 13:47, harry wrote: > Tony Morris tmorris.net> writes: >> >> >> (`foo` 3) >> Scala is very limited when it comes to this point free code. >> >> On 29/12/2013 10:17 PM, "harry" hotmail.com> wrote: >> >> Is there any reason not to include Scala-like anonymous arguments in >> Haskell? For example, I would like to write >> map (\x -> foo x 3) >> as >> map (foo _ 3) >> The named argument in this and similar cases adds nothing but visual and >> namespace clutter. > > How about a slightly more complex example? > > map (\x -> foo 4 'f' (bar x) 5 'j') > > There comes a point where point-free notation becomes unreadable. If you write map (foo 4 'f' (bar _) 5 'j') How would the compiler know whether you meant map (\x -> foo 4 'f' (bar x) 5 'j') or map (foo 4 'f' (\x -> bar x) 5 'j') ? Lambda's make it explicit where the variable is bound, which is a good thing, IMO. Twan From voldermort at hotmail.com Sun Dec 29 13:39:36 2013 From: voldermort at hotmail.com (harry) Date: Sun, 29 Dec 2013 13:39:36 +0000 (UTC) Subject: [Haskell-beginners] anonymous arguments References: <52C0227D.2050108@gmail.com> Message-ID: Twan van Laarhoven gmail.com> writes: > If you write > > map (foo 4 'f' (bar _) 5 'j') > > How would the compiler know whether you meant > > map (\x -> foo 4 'f' (bar x) 5 'j') > or > map (foo 4 'f' (\x -> bar x) 5 'j') > ? Interesting question, what does Scala do for this? I guess there would be a rule of always binding to the outermost or innermost scope. From toad3k at gmail.com Sun Dec 29 21:27:08 2013 From: toad3k at gmail.com (David McBride) Date: Sun, 29 Dec 2013 16:27:08 -0500 Subject: [Haskell-beginners] anonymous arguments In-Reply-To: References: <52C0227D.2050108@gmail.com> Message-ID: I've seen the question asked on stackoverflow before. It will be a very subtle bug that scala does not catch for you. You just have to have the discpline not to nest multiple anonymous functions with underscore arguments. There's no way for the compiler to disallow it because it cannot tell a mistake from something that is intentional. On Sun, Dec 29, 2013 at 8:39 AM, harry wrote: > Twan van Laarhoven gmail.com> writes: > > > If you write > > > > map (foo 4 'f' (bar _) 5 'j') > > > > How would the compiler know whether you meant > > > > map (\x -> foo 4 'f' (bar x) 5 'j') > > or > > map (foo 4 'f' (\x -> bar x) 5 'j') > > ? > > Interesting question, what does Scala do for this? I guess there would be a > rule of always binding to the outermost or innermost scope. > > > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > -------------- next part -------------- An HTML attachment was scrubbed... URL: From miroslav.karpis at gmail.com Mon Dec 30 23:42:26 2013 From: miroslav.karpis at gmail.com (Miro Karpis) Date: Tue, 31 Dec 2013 00:42:26 +0100 Subject: [Haskell-beginners] foldM with tuple and maybe Message-ID: Hi, please can you help me with following? I have a following function: f1 :: (String, String) -> IO (Maybe String) which I would like to apply to a list of tuples.I have defined the function like this, but that gives me error (below): f2 :: [(String, String)] -> IO (Maybe String) f2 x = foldM f1 0 x error: Couldn't match expected type `IO (Maybe String)' with actual type `[b0] -> m0 (String, String)' In the return type of a call of `foldM' thanks, m. -------------- next part -------------- An HTML attachment was scrubbed... URL: From toad3k at gmail.com Tue Dec 31 00:01:44 2013 From: toad3k at gmail.com (David McBride) Date: Mon, 30 Dec 2013 19:01:44 -0500 Subject: [Haskell-beginners] foldM with tuple and maybe In-Reply-To: References: Message-ID: You have a foldM function which takes a " a -> b -> m a " as a first argument. But you are passing it f1 which has a type (a, b) -> m a. Unfortunately I'm not sure what you were trying to do. The function you have just doesn't fit. :( Maybe you intended to have f1 :: String -> (String, String) -> IO String, and then go :t foldM f1 "" x foldM f1 "" [("a","b"),("c","d")] :: IO String ? On Mon, Dec 30, 2013 at 6:42 PM, Miro Karpis wrote: > Hi, please can you help me with following? > > I have a following function: > f1 :: (String, String) -> IO (Maybe String) > > which I would like to apply to a list of tuples.I have defined the function > like this, but that gives me error (below): > > f2 :: [(String, String)] -> IO (Maybe String) > f2 x = foldM f1 0 x > > > error: > Couldn't match expected type `IO (Maybe String)' with actual type `[b0] -> > m0 (String, String)' In the return type of a call of `foldM' > > thanks, > m. > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > From anguscomber at gmail.com Tue Dec 31 14:46:03 2013 From: anguscomber at gmail.com (Angus Comber) Date: Tue, 31 Dec 2013 14:46:03 +0000 Subject: [Haskell-beginners] Trying to understand function types eg iterate (a -> a) Message-ID: iterate' :: (a -> a) -> a -> [a] I am trying going to go ahead and write my own iterate function. But before I do I want to be clear on types. Looking at :: (a -> a) -> a -> [a] The first part is (a -> a) Now because it is in parentheses it is a function? I can call iterate like this: take 5 $ iterate (*2) 5 So (*2) is a possible function. Does the brackets mean it is a function, the left hand a is indicating a general type and the right hand a means the return type must be the same as the function type. Eg in the case of (*2) the 2 is an Int so the function returns and Int? Is my understanding correct? How could this be better explained? The last bit is easier to understand. a -> [a] meaning a singleton of general type and [a] means a list of same type. -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter.hall at memorphic.com Tue Dec 31 14:53:44 2013 From: peter.hall at memorphic.com (Peter Hall) Date: Tue, 31 Dec 2013 14:53:44 +0000 Subject: [Haskell-beginners] Trying to understand function types eg iterate (a -> a) In-Reply-To: References: Message-ID: When you wrap an operator in parentheses and supply just one of its arguments, then it's called an operator section. It's syntactic sugar for partially applying the operator, as you can with other functions. This: (*2) is exactly equivalent to: (\x -> x*2) and it's type is something like: Int -> Int And: (2:) is equivalent to: (\x -> 2:x) etc On 31 December 2013 14:46, Angus Comber wrote: > iterate' :: (a -> a) -> a -> [a] > > I am trying going to go ahead and write my own iterate function. But > before I do I want to be clear on types. > > Looking at :: (a -> a) -> a -> [a] > > The first part is (a -> a) Now because it is in parentheses it is a > function? > > I can call iterate like this: > take 5 $ iterate (*2) 5 > > So (*2) is a possible function. Does the brackets mean it is a function, > the left hand a is indicating a general type and the right hand a means the > return type must be the same as the function type. Eg in the case of (*2) > the 2 is an Int so the function returns and Int? Is my understanding > correct? > > How could this be better explained? > > The last bit is easier to understand. a -> [a] meaning a singleton of > general type and [a] means a list of same type. > > > > > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From idivyanshu.ranjan at gmail.com Tue Dec 31 14:55:13 2013 From: idivyanshu.ranjan at gmail.com (divyanshu ranjan) Date: Tue, 31 Dec 2013 20:25:13 +0530 Subject: [Haskell-beginners] Trying to understand function types eg iterate (a -> a) In-Reply-To: References: Message-ID: Hi Angus, Your understanding is correct. Parenthesis is need in a -> a to specify that it is function from a to a because associativity of -> is from right to left. (*2) is section, you can read more about here : http://www.haskell.org/haskellwiki/Section_of_an_infix_operator. Type of (*2) is (Num a) :: a -> a rather than particular type Int. Thanks Divyanshu Ranjan On Tue, Dec 31, 2013 at 8:16 PM, Angus Comber wrote: > iterate' :: (a -> a) -> a -> [a] > > I am trying going to go ahead and write my own iterate function. But > before I do I want to be clear on types. > > Looking at :: (a -> a) -> a -> [a] > > The first part is (a -> a) Now because it is in parentheses it is a > function? > > I can call iterate like this: > take 5 $ iterate (*2) 5 > > So (*2) is a possible function. Does the brackets mean it is a function, > the left hand a is indicating a general type and the right hand a means the > return type must be the same as the function type. Eg in the case of (*2) > the 2 is an Int so the function returns and Int? Is my understanding > correct? > > How could this be better explained? > > The last bit is easier to understand. a -> [a] meaning a singleton of > general type and [a] means a list of same type. > > > > > > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From anguscomber at gmail.com Tue Dec 31 18:48:59 2013 From: anguscomber at gmail.com (Angus Comber) Date: Tue, 31 Dec 2013 18:48:59 +0000 Subject: [Haskell-beginners] How to get each list in a list of lists for filter Message-ID: I am getting a list of lists from chop9. I want to somehow filter each element in the list. How do I do that. I have encoded binary data eg [1,1,0,0,1,0] etc Each 9th bit is a parity bit which is checked using this function: type Bit = Int paritychecker :: [Bit] -> Bool paritychecker xs | length xs == 9 && ((sum (init xs)) `mod` 2) == (last xs) = True | otherwise = False In the stream (the list) I use chop to retrieve each block of 9 bits as in: chop9 :: [Bit] -> [[Bit]] chop9 [] = [] chop9 bits = take 8 bits : chop9 (drop 8 bits) I have been playing with this sort of thing: filter paritychecker ??? chop9 [1,0,0,0,1,1,1,0,0,...] But doesn't work. I want to end up with all the 9 bit chunks which pass the filter. So my end type should be [[Bit]] paritychecker requires a list - eg [Bit] . So I want to run paritychecker on each element returned from chop9. How do I do that? Example encoded data stream: [1,0,0,0,1,1,1,0,0,1,1,1,0,1,1,1,0,0,1,0,1,0,0,1,1,0,0,0,1,0,0,1,1,1,0,0,0,0,1,0,1,1,1,0,0,1,0,0,1,1,1,1,0,1] Angus -------------- next part -------------- An HTML attachment was scrubbed... URL: From idivyanshu.ranjan at gmail.com Tue Dec 31 18:57:07 2013 From: idivyanshu.ranjan at gmail.com (divyanshu ranjan) Date: Wed, 1 Jan 2014 00:27:07 +0530 Subject: [Haskell-beginners] How to get each list in a list of lists for filter In-Reply-To: References: Message-ID: Hi Angus, Try placing $ in place of ???. Type of filter is (a->Bool) -> [a] -> [a]. $ is of type (a->b) -> a -> b but it's low priority so left and right hand side is calculated before function application. Thanks Divyanshu Ranjan On Wed, Jan 1, 2014 at 12:18 AM, Angus Comber wrote: > I am getting a list of lists from chop9. I want to somehow filter each > element in the list. How do I do that. > > I have encoded binary data eg [1,1,0,0,1,0] etc > > Each 9th bit is a parity bit which is checked using this function: > > type Bit = Int > > paritychecker :: [Bit] -> Bool > paritychecker xs | length xs == 9 && ((sum (init xs)) `mod` 2) == (last > xs) = True > | otherwise = False > > > In the stream (the list) I use chop to retrieve each block of 9 bits as in: > > chop9 :: [Bit] -> [[Bit]] > chop9 [] = [] > chop9 bits = take 8 bits : chop9 (drop 8 bits) > > I have been playing with this sort of thing: > filter paritychecker ??? chop9 [1,0,0,0,1,1,1,0,0,...] > > But doesn't work. > > I want to end up with all the 9 bit chunks which pass the filter. So my > end type should be [[Bit]] > > paritychecker requires a list - eg [Bit] . So I want to run paritychecker > on each element returned from chop9. How do I do that? > > Example encoded data stream: > > [1,0,0,0,1,1,1,0,0,1,1,1,0,1,1,1,0,0,1,0,1,0,0,1,1,0,0,0,1,0,0,1,1,1,0,0,0,0,1,0,1,1,1,0,0,1,0,0,1,1,1,1,0,1] > > Angus > > _______________________________________________ > Beginners mailing list > Beginners at haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bo at ct.de Tue Dec 31 20:34:44 2013 From: bo at ct.de (=?ISO-8859-1?Q?Harald_B=F6geholz?=) Date: Tue, 31 Dec 2013 21:34:44 +0100 Subject: [Haskell-beginners] How to get each list in a list of lists for filter In-Reply-To: References: Message-ID: <52C32A64.5000005@ct.de> Am 31.12.13 19:48, schrieb Angus Comber: > I am getting a list of lists from chop9. I want to somehow filter each > element in the list. How do I do that. > > I have encoded binary data eg [1,1,0,0,1,0] etc > > Each 9th bit is a parity bit which is checked using this function: > > type Bit = Int > > paritychecker :: [Bit] -> Bool > paritychecker xs | length xs == 9 && ((sum (init xs)) `mod` 2) == (last xs) > = True > | otherwise = False > > > In the stream (the list) I use chop to retrieve each block of 9 bits as in: > > chop9 :: [Bit] -> [[Bit]] > chop9 [] = [] > chop9 bits = take 8 bits : chop9 (drop 8 bits) > > I have been playing with this sort of thing: > filter paritychecker ??? chop9 [1,0,0,0,1,1,1,0,0,...] > > But doesn't work. Could a simple typo be the problem? Shouldn't chop9 .. take 9 bits ... and ... drop 9 bits ... instead of 8? Harald -- Harald B?geholz (PGP key available from servers) Redaktion c't Tel.: +49 511 5352-300 Fax: +49 511 5352-417 http://www.ct.de/ int f[9814],b,c=9814,g,i;long a=1e4,d,e,h; main(){for(;b=c,c-=14;i=printf("%04d",e+d/a),e=d%a) while(g=--b*2)d=h*b+a*(i?f[b]:a/5),h=d/--g,f[b]=d%g;} (Arndt/Haenel) Affe Apfel Vergaser /* Heise Zeitschriften Verlag GmbH & Co. KG * Karl-Wiechert-Allee 10 * 30625 Hannover * Registergericht: Amtsgericht Hannover HRA 26709 * Pers?nlich haftende Gesellschafterin: Heise Zeitschriften Verlag * Gesch?ftsf?hrung GmbH * Registergericht: Amtsgericht Hannover, HRB 60405 * Gesch?ftsf?hrer: Ansgar Heise, Dr. Alfons Schr?der */