Why I am forced to write the (Data Constructor) name with first letter in small case?

Posted by Optimight on Stack Overflow See other posts from Stack Overflow or by Optimight
Published on 2012-06-27T02:48:23Z Indexed on 2012/06/27 3:16 UTC
Read the original article Hit count: 172

Filed under:

Why I am forced to write "liOfLi" in place of "LiOfLi"? Please guide.

code in baby.hs

LiOfLi = [ [1,3,4,5,6,8], [ 12, 13, 15, 16, 19, 20], [23, 24, 25, 45, 56] ]

ghci response:

ghci> :l baby
[1 of 1] Compiling Main ( baby.hs, interpreted )
Failed, modules loaded: none.

ghci> baby.hs:29:1: Not in scope: data constructor `LiOfLi'

When changing the initial letter to smaller case

code in baby.hs

liOfLi = [ [1,3,4,5,6,8], [ 12, 13, 15, 16, 19, 20], [23, 24, 25, 45, 56] ]

ghci response:

ghci> :l baby
[1 of 1] Compiling Main ( baby.hs, interpreted )
Ok, modules loaded: Main.

Following are the SO questions I refered but I failed to understand the rules/ logic and get the answer for (my) abovementioned question.

Why does Haskell force data constructor's first letter to be upper case?

the variable names need to be lowercase. The official documentation related to this is at haskell.org/onlinereport/intro.html#namespaces – (the SO comment by) Chris Kuklewicz

© Stack Overflow or respective owner

Related posts about haskell