[Haskell-beginners] list range

José Romildo Malaquias j.romildo at gmail.com
Wed Dec 28 20:37:03 CET 2011


On Wed, Dec 28, 2011 at 07:51:35PM +0100, Stanisław Findeisen wrote:
> Hi
> 
> Is list range (for example: [1..10]) a language construct or a function?
> What type does it have?
> 

  [ 1 .. 10 ]

is syntatic sugar for the function application

  enumFromTo 1 10

enumFromTo is a method of the class Enum. Its type is

  enumFromTo :: Enum a => a -> a -> [a]

There is also enumFrom, enumFromThen and enumFromThenTo.

Romildo



More information about the Beginners mailing list