Re: [Haskell-cafe] Re: If wishes were horses...

2010-03-15 Thread wren ng thornton
Ben Millwood wrote: In general, laziness behaviour can get complicated quickly and so I'm not convinced that the type signature is a good home for that information. Certainly it can. A lot of the same problems arise in the logic programming community under the topic of "modes", i.e. whether a

Re: [Haskell-cafe] Re: If wishes were horses...

2010-03-14 Thread Ben Millwood
On Sat, Mar 13, 2010 at 3:19 AM, wren ng thornton wrote: > > The usual approach I've seen is not to distinguish strict and lazy > datatypes, but rather to distinguish strict and lazy functions, e.g. by > having two different arrows: (->) for lazy functions and (!->) for strict > ones.[1] > But wh

Re: [Haskell-cafe] Re: If wishes were horses...

2010-03-12 Thread wren ng thornton
Ketil Malde wrote: What should the type look like? If memory serves, Clean allows bangs in type signatures, something like: foldl' :: (a -> b -> a) -> !a -> [b] -> a but I thought it just added a seq under the hood, much like bang patterns like foldl' f !z xs = ... do in Haskell, so it

Re: [Haskell-cafe] Re: If wishes were horses... (was: Re: definition of sum)

2010-03-12 Thread Brandon S. Allbery KF8NH
On Mar 12, 2010, at 06:01 , Johannes Waldmann wrote: in this case, something like: Data.List.Strict.fold, Data.List.Lazy.fold Or - if we had static overloading, and strictness info in the type, then we wouldn't need different names. Can of worms ... Doesn't help if strictness needs to be c

Re: [Haskell-cafe] Re: If wishes were horses...

2010-03-12 Thread Max Bolingbroke
On 12 March 2010 10:38, Ketil Malde wrote: > What should the type look like?  If memory serves, Clean allows bangs in > type signatures, something like: > >  foldl' :: (a -> b -> a) -> !a -> [b] -> a > > but I thought it just added a seq under the hood, Thats my understanding too. I did look bri

Re: [Haskell-cafe] Re: If wishes were horses...

2010-03-12 Thread Henning Thielemann
On Fri, 12 Mar 2010, Johannes Waldmann wrote: Ketil Malde malde.org> writes: Prelude Data.List> :t foldl foldl :: (a -> b -> a) -> a -> [b] -> a What should the type look like? Good question - and in my posting I tried to avoid the impression that I have an answer, because I really haven

[Haskell-cafe] Re: If wishes were horses... (was: Re: definition of sum)

2010-03-12 Thread Johannes Waldmann
David Virebayre gmail.com> writes: > But then if you need both version, you will have to import them > qualified, which I don't like much. solution: type directed name resolution: * either in the language, http://hackage.haskell.org/trac/haskell-prime/wiki/TypeDirectedNameResolution * or, fa

Re: [Haskell-cafe] Re: If wishes were horses... (was: Re: definition of sum)

2010-03-12 Thread David Virebayre
On Fri, Mar 12, 2010 at 12:01 PM, Johannes Waldmann wrote: > David Virebayre gmail.com> writes: > in this case, something like:  Data.List.Strict.fold, Data.List.Lazy.fold But then if you need both version, you will have to import them qualified, which I don't like much. __

Re: [Haskell-cafe] Re: If wishes were horses... (was: Re: definition of sum)

2010-03-12 Thread Daniel Fischer
Am Freitag 12 März 2010 12:14:06 schrieb Paul R: > wren> I wish Haskell allowed ! to occur (non-initially) in alphanum_' > wren> identifiers as well as in symbolic ones. Then we could be more > wren> consistent about having ! mean strictness > > BTW, does something in haskell syntax prevent '?' fro

[Haskell-cafe] Re: If wishes were horses... (was: Re: definition of sum)

2010-03-12 Thread Paul R
wren> I wish Haskell allowed ! to occur (non-initially) in alphanum_' wren> identifiers as well as in symbolic ones. Then we could be more wren> consistent about having ! mean strictness BTW, does something in haskell syntax prevent '?' from appearing at the end of identifiers ? It is a nice way

[Haskell-cafe] Re: If wishes were horses...

2010-03-12 Thread Johannes Waldmann
Ketil Malde malde.org> writes: > > Prelude Data.List> :t foldl > > foldl :: (a -> b -> a) -> a -> [b] -> a > > What should the type look like? Good question - and in my posting I tried to avoid the impression that I have an answer, because I really haven't. My suggestion was that some of the

[Haskell-cafe] Re: If wishes were horses... (was: Re: definition of sum)

2010-03-12 Thread Johannes Waldmann
David Virebayre gmail.com> writes: > Even if we had a syntax to express that the function is strict, > wouldn't we still need two distinct function names for the strict and > lazy case ? OK, I'd like to register a "code smell" for: "hierarchical/systematic structure inside identifier names"; su

Re: [Haskell-cafe] Re: If wishes were horses...

2010-03-12 Thread Ketil Malde
Johannes Waldmann writes: > Well, meaningful identifier names is nice, but I think > here we have a case of the code smell "type info embedded in the name". > Strictness of a function should be expressed in the function's type instead. I've stumbled into this sentiment before, and it's one of t

Re: [Haskell-cafe] Re: If wishes were horses... (was: Re: definition of sum)

2010-03-12 Thread David Virebayre
On Fri, Mar 12, 2010 at 10:29 AM, Johannes Waldmann wrote: > Well, meaningful identifier names is nice, but I think > here we have a case of the code smell "type info embedded in the name". > Strictness of a function should be expressed in the function's type instead. > But that seems impossible

[Haskell-cafe] Re: If wishes were horses... (was: Re: definition of sum)

2010-03-12 Thread Johannes Waldmann
> > Note that foldl' has a ' to indicate that it's not the same as foldl > > exactly. I would propose that sum' exist as well as sum, and that sum be > > lazy. Well, meaningful identifier names is nice, but I think here we have a case of the code smell "type info embedded in the name". Strictnes