[Haskell] Re: A question about fundeps <-> GADT interaction
Tomasz Zielonka
tomasz.zielonka at gmail.com
Tue Dec 27 15:51:15 EST 2005
On Fri, Dec 23, 2005 at 12:10:07PM +0100, Tomasz Zielonka wrote:
> On Fri, Dec 23, 2005 at 03:34:40AM -0000, oleg at pobox.com wrote:
> >
> > [Sorry for possible duplication, our DNS server seems to be broken,
> > and the sysadm is on vacation]
> >
> > I don't think that is the problem with GADTs. The following works
> >
> > > untype :: Term f a -> Term Untyped ()
> > > untype (Lit x) = Lit x
> > > untype (Succ t) = Succ (untype t)
> > > untype (IsZero t) = IsZero ((untype t)::Term Untyped ())
> > > untype (If c t e) = If ((untype c)::Term Untyped ())
> > > ((untype t)::Term Untyped ())
> > > ((untype e)::Term Untyped ())
>
> I just checked that the only required change is the one
> in type signature. But I can't explain it at this moment.
I tried to implement another function:
mapChildren :: (forall a. Term f a -> Term f a) -> Term f b -> Term f b
mapChildren fun t@(Lit x) = t
mapChildren fun (IsZero t) = IsZero (fun t)
mapChildren fun (Succ t) = Succ (fun t)
mapChildren fun (If c t e) = If (fun c) (fun t) (fun e)
It is supposed to be similar to gmapT from Data.Generics - apply 'fun'
to every immediate Expr child of the node. Unfortunately, I don't know
how to make it compile. I tried a couple of different type signatures.
Best regards
Tomasz
--
I am searching for a programmer who is good at least in some of
[Haskell, ML, C++, Linux, FreeBSD, math] for work in Warsaw, Poland
More information about the Haskell
mailing list