Re: [Haskell-cafe] Question on definition of `parse' function in Parsec library.

2011-10-10 Thread Christian Maeder
Am 08.10.2011 16:04, schrieb Captain Freako: Hi all, In this definition from the Parsec library: parse :: (Stream s Identity t) = Parsec s () a - SourceName - s - Either ParseError a parse p = runP p () what's the significance of `Identity t'? (`t' isn't used

[Haskell-cafe] Question on definition of `parse' function in Parsec library.

2011-10-08 Thread Captain Freako
Hi all, In this definition from the Parsec library: parse :: (Stream s Identity t) = Parsec s () a - SourceName - s - Either ParseError aparse p = runP p () what's the significance of `Identity t'? (`t' isn't used anywhere.) Thanks, -db ___

Re: [Haskell-cafe] Question on definition of `parse' function in Parsec library.

2011-10-08 Thread Yves Parès
If I have this right, Stream is a monad transformer. Stream s m t means that it parses 's', is stacked with monad 'm' and has a result of type 't' So Identity is a monad, the simplest monad, defined as such: newtype Indentity t = Identity { runIdentity :: t } It's the identity monad, that does

Re: [Haskell-cafe] Question on definition of `parse' function in Parsec library.

2011-10-08 Thread Yves Parès
Wow... my bad. Stream is in no way a monad transformer. I really should read before speaking... Stream s m t is such as An instance of Stream has stream type s, underlying monad m and token type t determined by the stream (