Data.Generics generic unification?
Ralf.Laemmel at cwi.nl
Ralf.Laemmel at cwi.nl
Wed Mar 24 23:26:27 EST 2004
Hi.
there is a demo example that is coming (somewhat) close to what
you ask for: http://www.cs.vu.nl/boilerplate/testsuite/gzip/Main.hs
Boilerplate paper II with some of the relevant background is
found at: http://www.cs.vu.nl/boilerplate
If you complete anything along the lines you describe, please
let me know. Could be a nice entry in the boilerplate suite.
Ralf
> Hi
>
> Has anybody done generic unification algorithm (e.g. using
> Data.Generics)?
>
> The idea is to do the unifications in a state monad (like
> http://portal.acm.org/citation.cfm?id=507648&dl=ACM&coll=portal ), but
> without having to have two level types.
>
> It would be cool to have a data type, e.g.
>
> data Var a = Bound a | Unbound
>
> data STVar s a = STRef s (Var a)
>
> So then I could define my own data type, say person, with a mix of
> logical variables and constants:
>
> data Person :: Person s {
> ssn :: Int,
> name :: STVar s String,
> spouse :: STVar s (Person s)
> }
>
> So ssn would be a constant, while name and spouse would be logical
> variables.
>
> unify would need to be a generic function, bringing together basic
> functions like:
>
> unifyStringString :: String - > String -> ST s ()
> unifyVarString :: STVar s String - > String -> ST s ()
> (for basic types)
>
> and
>
> genericUnify :: a -> a -> ST s ()
> genericVarActualUnify :: (STVar s a) -> a -> ST s ()
> genericActualVarUnify :: a -> (STVar s a) -> ST s ()
> genericVarVarUnify :: (STVar s a) -> (STVar s a) -> ST s ()
>
> Cheers
>
> John
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
More information about the Glasgow-haskell-users
mailing list