Re:Basic Type-Level Programming in Haskell
by Xophmeister on Friday April 28, 2017 @11:01AM
(#14219904)
I'm not an experienced Haskell programmer, but I've never seen someone use different names for the type and the type constructor, as in:
They belong to different namespaces, so you can use the same name:
Indeed, I believe this is preferred as it reduces the programmer's cognitive load.
[ Parent
| on HN ]
This seems to be the convention in Idris where
data IntAndChar = IntAndChar Int Char
would not compile with Main.IntAndChar already defined.It's common convention to keep them the same, but in this case it may be useful to distinguish between the type and the term level value.
In this case, I think the different name for the constructor was chosen specifically to show the difference between the term and type level. I think it's a good idea, when explaining Haskell, to not assume that no one gets confused by the constructor and type having the same name (it confused me to begin with).