[Haskell-beginners] list range

Henry Lockyer henry.lockyer at ntlworld.com
Wed Dec 28 20:37:42 CET 2011


Hi again Stanislaw,
since I started digging in this hole.. 
Having just checked "enum" in the prelude there are a number of functions such as "enumFrom", "enumFromThen", "enumFromTo" etc. that the list range notation syntactic sugar is converted to.
/Henry

On 28 Dec 2011, at 19:08, Henry Lockyer wrote:

> Sorry, should have read your question a second time instead of posting a quick reply ;-)
> I think it is syntactic sugar..
> 
> On 28 Dec 2011, at 19:05, Henry Lockyer wrote:
> 
>> I'm a beginner so beware, but I believe [1..10] is a VALUE (it is not a function from something to something else).
>> It's type is essentially 'list of numeric' but because you used "..."  to express a range of values it also has to be of 
>> type 'Enum' as well as numeric.
>> If you have GHCI installed, then I recommend using the ":t" command to explore the types of Haskell expressions.
>> / Henry
>> 
>> On 28 Dec 2011, at 18:51, Stanisław Findeisen wrote:
>> 
>>> Hi
>>> 
>>> Is list range (for example: [1..10]) a language construct or a function?
>>> What type does it have?
>>> 
>>> -- 
>>> This e-mail address is invalid, see:
>>> http://people.eisenbits.com/~stf/public-email-note.html .
>>> 
>>> OpenPGP: E3D9 C030 88F5 D254 434C  6683 17DD 22A0 8A3B 5CC0
>>> 
>>> _______________________________________________
>>> Beginners mailing list
>>> Beginners at haskell.org
>>> http://www.haskell.org/mailman/listinfo/beginners
>> 
> 




More information about the Beginners mailing list