= vs ->

2001-10-09 Thread Mark Carroll
What is the rationale for when Haskell demands a "=" and when it demands a "->"? Ideas that occur to me are: (a) The distinction helps the parser a lot (b) There's a semantic difference that the language's grammar is trying to express that isn't obvious to me -- Mark ___

[Haskell-cafe] "Search" vs "search" vs "search"

2009-04-24 Thread haskell
Hi, I have some usability issues with the Haskell homepage. What is the best place to discuss them? 1) "Search" vs "search" vs "search" The front page has 3 search boxes: * at the top with the buttons "Go" and "Search" * the third link on the

[Haskell-cafe] Data.ByteString vs Data.ByteString.Lazy vs Data.ByteString.Char8

2008-12-02 Thread Galchin, Vasili
Hello, Some mention is made in corresponding web pages about implementation difference of these three different DataString impl. Any advice? Regards, Vasili ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listi

[Haskell-cafe] error vs. MonadError vs. fail

2006-03-26 Thread Daniel McAllansmith
Is there a consensus on how anticipatable failure situations should be handled? There was a thread, "haskell programming guidelines", from 2006-02-25 where John Meacham and Cale Gibbard had a bit of back-and-forth about using Monad.fail or a purpose specific MonadFail class. I believe a conse

Re: = vs ->

2001-10-09 Thread Ashley Yakeley
At 2001-10-09 11:55, Mark Carroll wrote: >What is the rationale for when Haskell demands a "=" and when it demands >a "->"? What? Example please... -- Ashley Yakeley, Seattle WA ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.or

Re: = vs ->

2001-10-09 Thread Mark Carroll
On Tue, 9 Oct 2001, Ashley Yakeley wrote: > At 2001-10-09 11:55, Mark Carroll wrote: > > >What is the rationale for when Haskell demands a "=" and when it demands > >a "->"? > > What? Example please... e.g. x :: Integer -> Integer y :: Integer -> Integer z :: Integer -> Integer x 1 = 1 x 2

Re: = vs ->

2001-10-09 Thread Ketil Malde
Mark Carroll <[EMAIL PROTECTED]> writes: > On Tue, 9 Oct 2001, Ashley Yakeley wrote: >> At 2001-10-09 11:55, Mark Carroll wrote: >>> What is the rationale for when Haskell demands a "=" and when it >>> demands a "->"? Okay, I can't give you anything formal, but here's my intuitive understandin

Re: = vs ->

2001-10-09 Thread Ashley Yakeley
At 2001-10-09 17:36, Mark Carroll wrote: >So, for instance, how come function definitions and guards use "=" but >lambdas and cases use "->"? It's like this: f x = fx f = \x -> fx f :: X -> FX f x = case x of x' -> fx' x'' -> fx'' Make sense? -- Ashley Yakeley, Seattle WA __

Re: = vs ->

2001-10-09 Thread D. Tweed
On 10 Oct 2001, Ketil Malde wrote: > Mark Carroll <[EMAIL PROTECTED]> writes: > > > On Tue, 9 Oct 2001, Ashley Yakeley wrote: > > >> At 2001-10-09 11:55, Mark Carroll wrote: > > >>> What is the rationale for when Haskell demands a "=" and when it > >>> demands a "->"? > > Okay, I can't give y

Re: = vs ->

2001-10-09 Thread D. Tweed
On Wed, 10 Oct 2001, D. Tweed wrote: > degenerate equality you get from defining the lhs in terms of the rhs. The > -> is used whenever you've got something on the right that `leads to' to ^left > something on the left, eg

Re: = vs ->

2001-10-10 Thread Mark Carroll
On 10 Oct 2001, Ketil Malde wrote: (snip) > function definitions. Perhaps one could have had a syntax like > > z a = > | a == 1 -> 1 > | a == 2 -> 3 > > instead, as it'd make it more consisten with the case, but I suppose > there's a reason for it being the way it is

Re: = vs ->

2001-10-10 Thread Frank Atanassow
;? For me, the difference is that "=" is used when the RHS (right-hand side) is bound to a pattern (or function decl. pattern) LHS in some scope, and "->" when the variables of the pattern on the LHS are free in the expression on the RHS. "<-" behaves like "="

Re: = vs ->

2001-10-10 Thread D. Tweed
On Wed, 10 Oct 2001, Mark Carroll wrote: > On 10 Oct 2001, Ketil Malde wrote: > (snip) > > function definitions. Perhaps one could have had a syntax like > > > > z a = > > | a == 1 -> 1 > > | a == 2 -> 3 > > > > instead, as it'd make it more consisten with the case,

Re: = vs ->

2001-10-12 Thread Fergus Henderson
On 10-Oct-2001, D. Tweed <[EMAIL PROTECTED]> wrote: > On Wed, 10 Oct 2001, Mark Carroll wrote: > > > On 10 Oct 2001, Ketil Malde wrote: > > (snip) > > > function definitions. Perhaps one could have had a syntax like > > > > > > z a = > > > | a == 1 -> 1 > > > | a ==

Re: = vs ->

2001-10-12 Thread D. Tweed
On Fri, 12 Oct 2001, Fergus Henderson wrote: [Dave Tweed wrote] > > sense. I'm not sure why anymore but Haskell changed the `if clause after > > the value' to `pattern guard | before =', so I agree it now looks as if > > it's stating that the pattern guard is equal to the rhs. > > I've heard th

Re: = vs ->

2001-10-12 Thread Paul Hudak
Being one of the old-timers who was deeply involved in this issue, I can assure you that the decision was not made out of fear that the idea was patented, since in fact this is the first I've heard of that! (All we knew was that the language was trademarked.) If I remember correctly, the main re

Re: [Haskell-cafe] "Search" vs "search" vs "search"

2009-04-24 Thread Johan Tibell
I like this idea. Some comments inline. On Fri, Apr 24, 2009 at 1:26 PM, wrote: > I'd propose something like the following grouping: > > * About Haskell > ** What is Haskell? > ** How does Haskell feels like? > ** Haskell success stories > ** Getting Started > *** Installation guide > *** First

Re: [Haskell-cafe] Data.ByteString vs Data.ByteString.Lazy vs Data.ByteString.Char8

2008-12-02 Thread Duncan Coutts
On Tue, 2008-12-02 at 17:43 -0600, Galchin, Vasili wrote: > Hello, > > Some mention is made in corresponding web pages about > implementation difference of these three different DataString impl. > Any advice? Perhaps you need to ask a more specific question. Data.ByteString is a simple str

Re: [Haskell-cafe] Data.ByteString vs Data.ByteString.Lazy vs Data.ByteString.Char8

2008-12-02 Thread Galchin, Vasili
I am getting a collision with "Internal" sigh. vasili On Tue, Dec 2, 2008 at 5:59 PM, Duncan Coutts <[EMAIL PROTECTED]>wrote: > On Tue, 2008-12-02 at 17:43 -0600, Galchin, Vasili wrote: > > Hello, > > > > Some mention is made in corresponding web pages about > > implementation differe

Re: [Haskell-cafe] Data.ByteString vs Data.ByteString.Lazy vs Data.ByteString.Char8

2008-12-02 Thread Galchin, Vasili
I think I am getting a namespace collition between Data.ByteString.Lazy.Char8.ByteString and Data.ByteString.Lazy.Internal.ByteString here is the error message Couldn't match expected type `B.ByteString' against inferred type `bytestring-0.9.0.1:Data.ByteStr

Re: [Haskell-cafe] Data.ByteString vs Data.ByteString.Lazy vs Data.ByteString.Char8

2008-12-02 Thread Ketil Malde
"Galchin, Vasili" <[EMAIL PROTECTED]> writes: > I think I am getting a namespace collition between > > Data.ByteString.Lazy.Char8.ByteString > > and > > Data.ByteString.Lazy.Internal.ByteString You rarely need to import 'Internal' directly. > here is the error message > >

Re: [Haskell-cafe] Data.ByteString vs Data.ByteString.Lazy vs Data.ByteString.Char8

2008-12-02 Thread Galchin, Vasili
On Wed, Dec 3, 2008 at 1:32 AM, Ketil Malde <[EMAIL PROTECTED]> wrote: > "Galchin, Vasili" <[EMAIL PROTECTED]> writes: > > > I think I am getting a namespace collition between > > > > Data.ByteString.Lazy.Char8.ByteString > > > > and > > > > Data.ByteString.Lazy.Internal.ByteString

Re: [Haskell-cafe] Data.ByteString vs Data.ByteString.Lazy vs Data.ByteString.Char8

2008-12-02 Thread Galchin, Vasili
Warning: This package indirectly depends on multiple versions of the same package. This is highly likely to cause a compile failure. package binary-0.4.2 requires bytestring-0.9.0.1 package bio-0.3.4.1 requires bytestring-0.9.1.0 ah ha .. Ketil, this is what you are saying? If so, how do I fix? i

Re: [Haskell-cafe] Data.ByteString vs Data.ByteString.Lazy vs Data.ByteString.Char8

2008-12-03 Thread Galchin, Vasili
, I get "resolving differences" If my assertion that the "delta" between the "global" vs "local" is causing my compile problems, then what should I do?? Regards, Vasili On Wed, Dec 3, 2008 at 1:52 AM, Galchin, Vasili <[EMAIL PROTECTED]> wrote:

Re: [Haskell-cafe] Data.ByteString vs Data.ByteString.Lazy vs Data.ByteString.Char8

2008-12-03 Thread Ketil Malde
"Galchin, Vasili" <[EMAIL PROTECTED]> writes: > Warning: This package indirectly depends on multiple versions of the same > package. This is highly likely to cause a compile failure. > package binary-0.4.2 requires bytestring-0.9.0.1 > package bio-0.3.4.1 requires bytestring-0.9.1.0 > ah ha .. Ke

Re: [Haskell-cafe] Data.ByteString vs Data.ByteString.Lazy vs Data.ByteString.Char8

2008-12-03 Thread Duncan Coutts
On Wed, 2008-12-03 at 01:52 -0600, Galchin, Vasili wrote: > Warning: This package indirectly depends on multiple versions of the > same > package. This is highly likely to cause a compile failure. > package binary-0.4.2 requires bytestring-0.9.0.1 > package bio-0.3.4.1 requires bytestring-0.9.1.0 >

Re: [Haskell-cafe] error vs. MonadError vs. fail

2006-03-27 Thread Andrew Pimlott
On Mon, Mar 27, 2006 at 02:53:58PM +1200, Daniel McAllansmith wrote: > Is there a consensus on how anticipatable failure situations should be > handled? > > There was a thread, "haskell programming guidelines", from 2006-02-25 where > John Meacham and Cale Gibbard had a bit of back-and-forth abo

Re: [Haskell-cafe] error vs. MonadError vs. fail

2006-03-28 Thread Daniel McAllansmith
On Tuesday 28 March 2006 07:29, Andrew Pimlott wrote: > > MonadError is not up to this task as far as I can tell. > > Why not? All that needs to be done is write the missing instances, eg > > instance MonadError () Maybe where > throwError x = Nothing > Nothing `catchErro

Re: [Haskell-cafe] error vs. MonadError vs. fail

2006-03-28 Thread Andrew Pimlott
On Wed, Mar 29, 2006 at 08:57:00AM +1200, Daniel McAllansmith wrote: > On Tuesday 28 March 2006 07:29, Andrew Pimlott wrote: > > > MonadError is not up to this task as far as I can tell. > > > > Why not? All that needs to be done is write the missing instances, eg > > > > instance MonadError (

Re: [Haskell-cafe] error vs. MonadError vs. fail

2006-03-28 Thread Daniel McAllansmith
On Wednesday 29 March 2006 09:49, Andrew Pimlott wrote: > If you want to write a MonadError operation that can be used with Maybe > or Either, it would look like > > f :: (MonadError e m, Error e) => Bool -> m Int > f b = if b > then return 42 > else throwError (strMsg "The

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-26 Thread John Meacham
Here are jhc's timings for the same programs on my machine. gcc and ghc both used -O3 and jhc had its full standard optimizations turned on. jhc: ./hs.out 5.12s user 0.07s system 96% cpu 5.380 total gcc: ./a.out 5.58s user 0.00s system 97% cpu 5.710 total ghc: ./try 31.11s user 0.00s system 9

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Neil Mitchell
Hi John, Any chance of seeing the benchmark? You're not the only one with an optimising compiler tucked away somewhere :-) I have one "benchmark" where I outperform GHC by 21 times, although saying it's artificial is a bit of an understatement... Thanks, Neil On Fri, Mar 26, 2010 at 6:27 PM, Jo

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Jason Dagit
On Sat, Mar 27, 2010 at 3:25 AM, Neil Mitchell wrote: > Hi John, > > Any chance of seeing the benchmark? You're not the only one with an > optimising compiler tucked away somewhere :-) > Neil, for some reason John's reply didn't thread with the rest of the thread. Probably because he changed th

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Rafael Cunha de Almeida
John Meacham wrote: > Here are jhc's timings for the same programs on my machine. gcc and ghc > both used -O3 and jhc had its full standard optimizations turned on. > > jhc: > ./hs.out 5.12s user 0.07s system 96% cpu 5.380 total > > gcc: > ./a.out 5.58s user 0.00s system 97% cpu 5.710 total >

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Lennart Augustsson
It's important to switch from mod to rem. This can be done by a simple abstract interpretation. I'm nore sure if it's jhc or gcc that does this for jhc. -- Lennart On Sat, Mar 27, 2010 at 10:30 PM, Rafael Cunha de Almeida wrote: > John Meacham wrote: >> Here are jhc's timings for the same pro

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Rafael Cunha de Almeida
Lennart Augustsson wrote: > It's important to switch from mod to rem. This can be done by a > simple abstract interpretation. > I'm nore sure if it's jhc or gcc that does this for jhc. > It's not just adding rem. Ghc still runs much slower using rem. It's only when switching to -fvia-C and using

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread John Meacham
On Sat, Mar 27, 2010 at 07:30:30PM -0300, Rafael Cunha de Almeida wrote: > John Meacham wrote: > > Here are jhc's timings for the same programs on my machine. gcc and ghc > > both used -O3 and jhc had its full standard optimizations turned on. > > > > jhc: > > ./hs.out 5.12s user 0.07s system 96%

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Roman Leshchinskiy
On 27/03/2010, at 05:27, John Meacham wrote: > Here are jhc's timings for the same programs on my machine. gcc and ghc > both used -O3 and jhc had its full standard optimizations turned on. > > jhc: > ./hs.out 5.12s user 0.07s system 96% cpu 5.380 total > > gcc: > ./a.out 5.58s user 0.00s syst

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Roman Leshchinskiy
On 28/03/2010, at 11:07, John Meacham wrote: > I have not thoroughly checked it, but I think there are a couple things > going on here: It could also be worthwhile to float out (i*i + j*j) in rangeK instead of computing it in every loop iteration. Neither ghc nor gcc can do this; if jhc can the

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-27 Thread Roman Leshchinskiy
On 28/03/2010, at 09:47, Lennart Augustsson wrote: > It's important to switch from mod to rem. This can be done by a > simple abstract interpretation. Also, changing the definition of rem from a `rem` b | b == 0 = divZeroError | a == minBound && b == (-1) = ove

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-28 Thread Lennart Augustsson
Does anything change if you swap the first two rhss? On Sun, Mar 28, 2010 at 1:28 AM, Roman Leshchinskiy wrote: > On 28/03/2010, at 09:47, Lennart Augustsson wrote: > >> It's important to switch from mod to rem.  This can be done by a >> simple abstract interpretation. > > Also, changing the def

Re: [Haskell-cafe] GHC vs GCC vs JHC

2010-03-29 Thread Roman Leshchinskiy
On 29/03/2010, at 02:27, Lennart Augustsson wrote: > Does anything change if you swap the first two rhss? No, not as far as I can tell. > > On Sun, Mar 28, 2010 at 1:28 AM, Roman Leshchinskiy > wrote: >> On 28/03/2010, at 09:47, Lennart Augustsson wrote: >> >>> It's important to switch from

Re: [Haskell-cafe] speed: ghc vs gcc vs jhc

2009-02-20 Thread John Meacham
Don't forget jhc: on my machine (with 'print' equivalent added to C one to be fair, and 10^9 changed to 1000*1000*1000 just like the C one) ghc: (-O2) time ./foo ./foo 2.26s user 0.00s system 99% cpu 2.273 total gcc: time ./a.out ./a.out 0.34s user 0.00s system 99% cpu 0.341 total jhc: time

Re: [Haskell-cafe] speed: ghc vs gcc vs jhc

2009-02-20 Thread Ketil Malde
Bulat Ziganshin writes: >> Don't forget jhc: > i was pretty sure that jhc will be as fast as gcc :) unfortunately, > jhc isn't our production compiler Neither is GCC :-) -k -- If I haven't seen further, it is by standing in the footprints of giants

Re: [Haskell-cafe] speed: ghc vs gcc vs jhc

2009-02-20 Thread John Meacham
On Sat, Feb 21, 2009 at 02:24:59AM +0300, Bulat Ziganshin wrote: > Hello John, > > Saturday, February 21, 2009, 2:14:25 AM, you wrote: > > > Heh. He probably meant something more like "jhc is not a production > > compiler" which is true for a lot of projects. For projects of > > substantial size

Re: [Haskell-cafe] speed: ghc vs gcc vs jhc

2009-02-20 Thread Alberto G. Corona
John, please update the section "All is not well in jhc-land" because now things are better isn´t? 2009/2/21 John Meacham > > On Sat, Feb 21, 2009 at 02:24:59AM +0300, Bulat Ziganshin wrote: > > Hello John, > > > > Saturday, February 21, 2009, 2:14:25 AM, you wrote: > > > > > Heh. He probably me

Re: [Haskell-cafe] speed: ghc vs gcc vs jhc

2009-02-20 Thread John Meacham
On Sat, Feb 21, 2009 at 03:21:03AM +0300, Bulat Ziganshin wrote: > >> what is "substantial size"? can jhc be used for video codec, i.e. > >> probably no extensions - just raw computations, and thousands or tens > >> of thousands LOCs? > > > Perhaps. A bigger issue in practice is that the larger a

Re: [Haskell-cafe] speed: ghc vs gcc vs jhc

2009-02-20 Thread John Meacham
On Sat, Feb 21, 2009 at 01:20:14AM +0100, Alberto G. Corona wrote: > John, > please update the section "All is not well in jhc-land" because now > things are better isn´t? Ah, are you refering to this page? http://repetae.net/computer/jhc/jhc.shtml That is just there for historical reasons as my

Re: [Haskell-cafe] speed: ghc vs gcc vs jhc

2009-02-20 Thread Alberto G. Corona
But it is very misleading. It would be nice to have a log or something similar to inform about the current state ://repetae.net/computer/jhc/jhc.shtml > That is just there for historical reasons as my initial announcement. > > more up to date info is > > in the manual: http://repetae.net/computer

Re: [Haskell-cafe] speed: ghc vs gcc vs jhc

2009-02-20 Thread Don Stewart
bulat.ziganshin: > Hello John, > > Saturday, February 21, 2009, 3:42:24 AM, you wrote: > > >> this is true for *application* code, but for codec you may have lots of > >> code that just compute, compute, compute > > > Yes indeed. If there is code like this out there for haskell, I would > > love

[Haskell-cafe] [] vs [()]

2008-10-09 Thread Daryoush Mehrtash
What is the difference between empty list [] and list with one unit element [()]? daryoush ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

reusing vs. interact

2000-09-25 Thread Jose Emilio Labra Gayo
This is a simple question about reusing a piece of Haskell code I had an interactive program which used a function of type > prg :: String -> String > prg = > {- for example -} \(c:cs) -> "first char = " ++ [c] To run that program I used > run :: IO () > run = interact prg Now, I want to

Re[2]: [Haskell-cafe] speed: ghc vs gcc vs jhc

2009-02-20 Thread Bulat Ziganshin
Hello John, Saturday, February 21, 2009, 1:33:12 AM, you wrote: > Don't forget jhc: i was pretty sure that jhc will be as fast as gcc :) unfortunately, jhc isn't our production compiler -- Best regards, Bulatmailto:bulat.zigans...@gmail.com __

Re[4]: [Haskell-cafe] speed: ghc vs gcc vs jhc

2009-02-20 Thread Bulat Ziganshin
Hello Thomas, Saturday, February 21, 2009, 1:52:27 AM, you wrote: >> i was pretty sure that jhc will be as fast as gcc :) unfortunately, >> jhc isn't our production compiler > Why not? There's nothing stopping you from choosing any Haskell > compiler you like. If jhc gives you the performanc

Re[4]: [Haskell-cafe] speed: ghc vs gcc vs jhc

2009-02-20 Thread Bulat Ziganshin
Hello John, Saturday, February 21, 2009, 2:14:25 AM, you wrote: > Heh. He probably meant something more like "jhc is not a production > compiler" which is true for a lot of projects. For projects of > substantial size or that require many extensions, jhc falls somewhat > short. It is getting bett

Re[2]: [Haskell-cafe] speed: ghc vs gcc vs jhc

2009-02-20 Thread Bulat Ziganshin
Hello John, Saturday, February 21, 2009, 2:49:25 AM, you wrote: >> what is "substantial size"? can jhc be used for video codec, i.e. >> probably no extensions - just raw computations, and thousands or tens >> of thousands LOCs? > Perhaps. A bigger issue in practice is that the larger a program i

Re[2]: [Haskell-cafe] speed: ghc vs gcc vs jhc

2009-02-20 Thread Bulat Ziganshin
Hello John, Saturday, February 21, 2009, 3:42:24 AM, you wrote: >> this is true for *application* code, but for codec you may have lots of >> code that just compute, compute, compute > Yes indeed. If there is code like this out there for haskell, I would > love to add it as a test case for jhc.

Re: Re[2]: [Haskell-cafe] speed: ghc vs gcc vs jhc

2009-02-20 Thread Thomas Davie
On 20 Feb 2009, at 23:44, Bulat Ziganshin wrote: Hello John, Saturday, February 21, 2009, 1:33:12 AM, you wrote: Don't forget jhc: i was pretty sure that jhc will be as fast as gcc :) unfortunately, jhc isn't our production compiler Why not? There's nothing stopping you from choosing an

Re: Re[4]: [Haskell-cafe] speed: ghc vs gcc vs jhc

2009-02-20 Thread Thomas Davie
On 21 Feb 2009, at 00:01, Bulat Ziganshin wrote: Hello Thomas, Saturday, February 21, 2009, 1:52:27 AM, you wrote: i was pretty sure that jhc will be as fast as gcc :) unfortunately, jhc isn't our production compiler Why not? There's nothing stopping you from choosing any Haskell compile

Re: Re[2]: [Haskell-cafe] speed: ghc vs gcc vs jhc

2009-02-20 Thread John Meacham
On Fri, Feb 20, 2009 at 11:52:27PM +0100, Thomas Davie wrote: > > On 20 Feb 2009, at 23:44, Bulat Ziganshin wrote: > >> Hello John, >> >> Saturday, February 21, 2009, 1:33:12 AM, you wrote: >> >>> Don't forget jhc: >> >> i was pretty sure that jhc will be as fast as gcc :) unfortunately, >> jhc isn

[Haskell-cafe] forall vs "=>"

2009-05-12 Thread Daryoush Mehrtash
What is the difference between forall as in: runST:: ( forall s. STs a) -> a and the "=>" as in evalStat

Re: [Haskell-cafe] [] vs [()]

2008-10-09 Thread Don Stewart
dmehrtash: >What is the difference between empty list [] and list with one unit >element [()]? Prelude> length [] 0 Prelude> length [()] 1 :-) -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/

Re: [Haskell-cafe] [] vs [()]

2008-10-09 Thread John Dorsey
> dmehrtash: > >What is the difference between empty list [] and list with one unit > >element [()]? > > Prelude> length [] > 0 > Prelude> length [()] > 1 Also, they differ in type. [()] is a list of unit elements, and happens to contain exactly one of them. [] is a (pol

Re: [Haskell-cafe] [] vs [()]

2008-10-09 Thread Sam Danielson
> What is the difference between empty list [] and list with one unit element > [()]? > The [] constructor takes no arguments and is like Nothing in the Maybe type. The list ":" (cons) infix constructor takes two arguments, an element of type a and a list of type a, to construct a new list. Com

[Haskell-cafe] Re: [] vs [()]

2008-10-09 Thread Benjamin L . Russell
On Fri, 10 Oct 2008 00:24:08 -0400, John Dorsey <[EMAIL PROTECTED]> wrote: >> dmehrtash: >> >What is the difference between empty list [] and list with one unit >> >element [()]? >> >> Prelude> length [] >> 0 >> Prelude> length [()] >> 1 > >Also, they differ in type. > >[(

[Haskell-cafe] Re: [] vs [()]

2008-10-10 Thread Jon Fairbairn
"Daryoush Mehrtash" <[EMAIL PROTECTED]> writes: > What is the difference between empty list [] and list with one unit > element [()]? Prelude> :m + Data.List Prelude Data.List> []\\[()] [] or, for completeness, the difference between a list with one unit element and the empty list:

Re: [Haskell-cafe] [] vs [()]

2008-10-10 Thread Ryan Ingram
(This is a literate haskell post, save into SMM.lhs and load in ghci!) Here's one place you might use [()] and []: > guard :: Bool -> [()] > guard True = [()] > guard False = [] You can then use "guard" in monadic list computations to abort the computation on some branches: > sendmoney :: [[Int

[Haskell-cafe] Re: [] vs [()]

2008-10-10 Thread Mauricio
What is the difference between empty list [] and list with one unit element [()]? Or, yet: ():[()] --is legal 10:[()] --is not One list can contain elements of a single type. Since the type of () is () (element constructors and types are allowed to have the same name), a list of type [()]

Re: [Haskell-cafe] [] vs [()]

2008-10-10 Thread Jonathan Cast
On Fri, 2008-10-10 at 10:59 -0700, Daryoush Mehrtash wrote: > I was in fact trying to figure out how "guard" worked in the "do". > The interesting (for a beginner) insight is that: > > [()] map f = [f] I don't think any clarity is added by made-up notation. I think you mean map f [

Re: [Haskell-cafe] [] vs [()]

2008-10-10 Thread Daryoush Mehrtash
I don't think any clarity is added by made-up notation. I think you mean In fact I was "trying" to be correct on this. Is it wrong to show: [()] >> f = f as was doing: [()] map f = [f] I want to say map function f over a single element list will yield a list of single element, the element be

Re: [Haskell-cafe] [] vs [()]

2008-10-10 Thread Daryoush Mehrtash
I was in fact trying to figure out how "guard" worked in the "do".The interesting (for a beginner) insight is that: [()] map f = [f] --( just as any list with one element would have been such as [1] map f = [f] ) where as [] map f = [] so if your guard computes to [()] (or any list of

Re: [Haskell-cafe] [] vs [()]

2008-10-10 Thread Jonathan Cast
On Fri, 2008-10-10 at 11:14 -0700, Daryoush Mehrtash wrote: > > I don't think any clarity is added by made-up notation. I > think you > mean > In fact I was "trying" to be correct on this. Great! > Is it wrong to show: > > [()] >> f = f > > as was doing: > > [()] ma

Re: [Haskell-cafe] [] vs [()]

2008-10-11 Thread Simon Richard Clarkstone
Sam Danielson wrote: The [] constructor takes no arguments and is like Nothing in the Maybe type. The list ":" (cons) infix constructor takes two arguments, an element of type a and a list of type a, to construct a new list. Compare to Maybe. data []a = [] | a : [a] data

Re: reusing vs. interact

2000-09-25 Thread Marcin 'Qrczak' Kowalczyk
Mon, 25 Sep 2000 17:17:15 +0200 (METDST), Jose Emilio Labra Gayo <[EMAIL PROTECTED]> pisze: > > prg :: String -> String > > prg = > > {- for example -} \(c:cs) -> "first char = " ++ [c] It provides no way to tell how much of input it really used, and how much it threw away. > Is it possibl

Re: reusing vs. interact

2000-09-25 Thread Jeffrey Straszhiem
On Mon, Sep 25, 2000 at 05:17:15PM +0200, Jose Emilio Labra Gayo wrote: > I had an interactive program which used a function of type > > prg :: String -> String > > prg = > > {- for example -} \(c:cs) -> "first char = " ++ [c] > To run that program I used > > run :: IO () > > run = interac

Re: "let" vs. "where"

2003-08-20 Thread Hamilton Richards
At 7:42 AM +0200 8/20/03, Jan Scheffczyk wrote: Hi Andrew, let x = expensiveComputation foo in x + x I would certainly hope that expensiveComputation wasn't called twice, and even though the language doesn't guarantee it, I have already written code that assumed it. I always thought that ther

[Haskell-cafe] Data.StorableVector vs Data.Vector.Storable

2013-03-24 Thread Roman Cheplyaka
What is the relationship between these two modules? Do we really need both? (Data.Vector.Storable is part of vector, Data.StorableVector is from a separate package, storablevector.) Roman ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://ww

[Haskell-cafe] Hoogle vs Hayoo

2013-08-22 Thread jabolopes
Hi, I noticed Hayoo appears as a link in the toolbox of http://hackage.haskell.org and also that Hayoo seems to display better results than Hoogle. For example, if you search for 'PublicKey' in Hayoo, you will get several results from Hackage libraries, such as, 'crypto-pubkey' and 'crypto-api'.

[Haskell-cafe] bytestring vs. uvector

2009-03-07 Thread Alexander Dunlap
Hi all, For a while now, we have had Data.ByteString[.Lazy][.Char8] for our fast strings. Now we also have Data.Text, which does the same for Unicode. These seem to be the standard for dealing with lists of bytes and characters. Now we also have the storablevector, uvector, and vector packages. T

[Haskell-cafe] ST.Lazy vs ST.Strict

2009-05-03 Thread Tobias Olausson
Hello! I have a program that is using ST.Strict, which works fine. However, the program needs to be extended, and to do that, lazy evaluation is needed. As a result of that, I have switched to ST.Lazy to be able to do stuff like foo y = do x <- something xs <- foo (y+1) return (x:xs)

Re: [Haskell-cafe] forall vs "=>"

2009-05-12 Thread wren ng thornton
Daryoush Mehrtash wrote: What is the difference between forall as in: runST :: (forall s. ST s a) -> a and the "=>" as in evalStateT :: Monad m => StateT s m a -> s -> m a The forall is Rank-2 polymorphism (the argument must be polymorphic in s). The => is for typeclass constraints (restric

Re: [Haskell-cafe] forall vs "=>"

2009-05-12 Thread Bulat Ziganshin
Hello Daryoush, Wednesday, May 13, 2009, 6:11:10 AM, you wrote: > runST :: (forall s. ST s a) -> a > evalStateT :: Monad m => StateT s m a -> s -> m a these are quite opposite things. later means that you should pass some value of Monad class (well, in this case it's StateT value whose type is

Re: [Haskell-cafe] forall vs "=>"

2009-05-13 Thread Jason Dusek
2009/05/12 Daryoush Mehrtash : > runST :: (forall s. ST s a) -> a The `forall` here has a rather elaborate purpose. > evalStateT :: Monad m => StateT s m a -> s -> m a "Where `m` is in `Monad`, we have... Let's put in the "hidden `forall`": evalStateT :: forall s m a. (Monad m) => St

[Haskell-cafe] Hugs vs. GHCi

2009-05-29 Thread Vladimir Reshetnikov
Hi, The following expression evaluates to 1 in GHCi, but results in an error in Hugs: let f x = let g y = [x,y] in (g 1, g []) in 1 What is the correct behavior? Thanks Vladimir ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell

[Haskell-cafe] let vs do?

2007-06-28 Thread Greg Meredith
Haskellians, Once you have a polymorphic let, why do you need 'let' in the base language, at all? Is it possible to formulate Haskell entirely with do-notation where there is a standard monad for let environments? Probably this was all discussed before in the design deliberations for the language

[Haskell-cafe] snoc vs cons

2007-07-24 Thread Eric
Does anyone know of a good article which discusses snoc vs cons lists? E. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] deepSeq vs. rnf?

2006-07-18 Thread Chad Scherrer
Now and again I see references to "deepSeq", and I've never understood how this could be any different than using rnf from Control.Parallel.Strategies. Is there really any difference? When is it better to use one or the other? Thanks, -- Chad Scherrer "Time flies like an arrow; fruit flies lik

[Haskell-cafe] evaluate vs seq

2006-09-09 Thread Michael Shulman
The GHC documentation says that (evaluate a) is not the same as (a `seq` return a). Can someone explain the difference to me, or point me to a place where it is explained? Mike ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.o

[Haskell-cafe] deepSeq vs rnf

2006-10-22 Thread Chad Scherrer
Hi, I had posted this question a while back, but I think it was in the middle of another discussion, and I never did get a reply. Do we really need both Control.Parallel.Strategies.rnf and deepSeq? Should we not always have x `deepSeq` y == rnf x `seq` y ? Maybe there's a distinction I'm missin

[Haskell-cafe] mtl vs monads

2007-01-02 Thread Conal Elliott
Are the mtl and monads (monadLib) packages both in active use? Is one being phased out? - Conal ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Newbie vs. laziness

2007-03-20 Thread Alex Queiroz
Hallo list, I don't quite get how ($!) works. I have this function: dbCreateIndices con dtn dof = do let dummy = newDbItem let query = "SELECT id FROM " ++ (dtn dummy) ++ " ORDER BY " ++ (dof dummy) ids <- liftM (map fromSql . concat ) $! quickQuery con query [] return $ IntMap.fromL

[Haskell-cafe] foldl vs foldl'

2008-11-04 Thread Daryoush Mehrtash
Are there cases (function or list) where the result of foldl (or foldr)would be different that foldl' (or foldr')? thanks, daryoush ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Data.Array.Storable vs GC

2008-11-25 Thread David F. Place
If you have a giant unboxed array that will never become garbage, it would be nice to put it somewhere where the GC won't bother with it. Since Data.Array.Storable arrays are allocated in the C heap, I thought it would be a good choice. However, I am getting very poor performance due to the GC cop

[Haskell-cafe] Yampa vs. Reactive

2008-12-16 Thread Tony Hannan
Hello, Can someone describe the advantages and disadvantages of the Yampa library versus the Reactive library for functional reactive programming, or point me to a link. Thanks, Tony P.S. It is hard to google for Yampa and Reactive together because "reactive" as in "function reactive programming

[Haskell-cafe] Bytestrings vs String?

2009-02-02 Thread Marc Weber
A lot of people are suggesting using Bytestrings for performance, strictness whatsoever reasons. However how well do they talk to other libraries? One I've in mind is hslogger right now. Should hslogger be implemented using Strings or Bytestrings ? Should there be two versions? hslogger-bytest

[Haskell-cafe] Data.Set.member vs Data.List.elem

2007-11-12 Thread Neil Mitchell
Hi, Is there a good reason that Data.Set uses the name "member" while Data.List (or the Prelude) uses the name "elem", for what to me seem identical concepts. I realise that in Set's the traditional test is for "membership", but it seems awfully arbitrary that one jumped one way and one jumped the

[Haskell-cafe] let vs. where

2007-11-13 Thread John Lato
Hello, I know there are several important differences between let-expressions and where-clauses regarding scoping and the restriction of "where" to a top-level definition. However, frequently I write code in which either one would be allowed, and I was wondering if there were any guidelines or pr

[Haskell-cafe] nhc vs ghc

2007-11-23 Thread brad clawsie
can anyone provide a concise list of the major differences between nhc98 and ghc? for example, can i build a cabal package with nhc98? i get that ghc and nhc98 are not interchangeable, otherwise i am not sure thanks pgpIGhA0uHtR7.pgp Description: PGP signature ___

[Haskell-cafe] fmap vs. liftM

2008-02-04 Thread Felipe Lessa
Hi there, Reading http://www.haskell.org/haskellwiki/Things_to_avoid I found an interesting saying: "By the way, in the case of IO monad the Functor class method fmap and the Monad based function liftM are the same." I always tought that prop :: (Functor m, Monad m, Eq (m b)) => (a -> b) -> m a

[Haskell-cafe] MTL vs Transformers?

2009-10-12 Thread Erik de Castro Lopo
Hi all, I've just received the following error message: headers.hs:6:7: Could not find module `Control.Monad.Identity': it was found in multiple packages: transformers-0.1.4.0 mtl-1.1.0.2 I'm trying to use the Iteratee module which depends on Transformers but I use MTL in other stuff

  1   2   3   4   5   6   7   8   9   10   >