[Haskell-cafe] What's the new type ?
miguelimo38 at yandex.ru
Thu Nov 5 03:28:06 EST 2009
In "type Parser" Parser is a type synonym. In GenParser, Parser is a
data constructor; they live in separate namespaces.
Yes, I admit, it's confusing.
> type Parser a = GenParser Char () a
> newtype GenParser tok st a = Parser (State tok st -> Consumed (Reply tok st
> As i know, the Parser type is just an alias of GenParser. Then can the
> second line be replaced as below?
> newtype GenParser tok st a = GenParser Char () (State tok st -> Consumed
> (Reply tok st a))
> If it can , then what is the new type ?
> fac n = foldr (*) 1 [1..n]
More information about the Haskell-Cafe