[Haskell-cafe] Continuable and serializable parsers.

Felipe Lessa felipe.lessa at gmail.com
Fri Dec 25 20:31:45 EST 2009


On Fri, Dec 25, 2009 at 05:12:22PM -0500, Antoine Latter wrote:
> In that case, You'll be able to serialize that as long as you can
> serialize (m a).
>
> I meant higher-order as in function-types. So you wouldn't be able to serialize:
>
> string :: String -> Parser String
>
> Unless you had some way to reify the particular function to data.

That's the idea, to create something like

    data MyParser = FunString String
                  | ...

    interpret :: MyParser -> Parser String
    interpret (FunString str) = string str

However you're right in a sense, you can't use this scheme to
serialize any functions taking functions, like

    something :: (a -> Parser a) -> a -> Parser a

because

    data MyParser = FunSomething (a -> MyParser) a

wouldn't be serializable.  Well, maybe if your parsers were
arrows... :)

--
Felipe.


More information about the Haskell-Cafe mailing list