[Haskell-cafe] parsec3 pre-release [attempt 2]

Bas van Dijk v.dijk.bas at gmail.com
Wed Feb 6 19:44:42 EST 2008

Probably a weird idea but could this be useful?

class (Monad m) => Stream s m t | s -> t where
    uncons :: s -> m (m (t,s))

for example:

instance (Monad m) => Stream [t] m t where
    uncons []     = return $ fail "uncons []"
    uncons (t:ts) = return $ return (t,ts)

One small advantage is that Streams can have custom error messages
when there's no input.

Also, using 'uncons' could be as simple as: 'join . uncons'.


On Feb 2, 2008 6:15 AM, Derek Elkins <derek.a.elkins at gmail.com> wrote:
> [Now with 100% more correct darcs get URLs.]
> I'm currently getting Paolo Martini's Google Summer of Code project, an
> updated version of Parsec, into a releasable state, and I will be
> maintaining it for at least a while.
> Paolo's major additions are:
>     * The Parser monad has been generalized into a Parser monad
>       transformer
>     * The parsers have been generalized to work over a stream of any
>       type, in particular, with bytestrings.
> I have made a few minor additions as well:
>     * There is Haddock documentation for almost all functions
>     * The Parser monad now has Applicative/Alternative instances
> Currently, I am looking for people to give it a go reporting any bugs in
> the library or documentation, troubles building it, or changes/features
> they would like.  I'm also interested in performance information.
> Most old Parsec code should be relatively easy but not trivial to port.
> There is a darcs repository on code.haskell.org.  If nothing comes up,
> I'll put a package on Hackage in about a week or so.
> To get the code:
> darcs get http://code.haskell.org/parsec3
> To build it, the standard cabal commands should work:
> http://haskell.org/haskellwiki/Cabal/How_to_install_a_Cabal_package
> Alternatively, you can use the cabal-install application:
> http://hackage.haskell.org/trac/hackage/wiki/CabalInstall
> The documentation can be generated also via the normal cabal routine, or
> via cabal-install.
> The Text.Parsec modules should be preferred to the
> Text.ParserCombinators.Parsec modules.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list