---------------------------------------------------------------- -- unify.phs -- contains the polytypic part of the unification algorithm -- (i.e. almost nothing) -- To test this: see README.txt -- module Term where -- import Base(inn,out,fmap) -- import Flatten(fflatten) -- import Eq(fequal) ---------------------------------------------------------------- --instance Regular d => Children (d a) where -- children = children' -- mapChildren = mapChildren' children' = fflatten . fmap nil singleton . out mapChildren' f = inn . fmap id f . out --instance (Regular d, Eq a) => TopEq (d a) where -- topEq = topEq' topEq' t t' = fequal (==) (\_ _ -> True) (out t) (out t') ---------------------------------------------------------------- -- all the examples have the variable as their first constructor varCheck' = fvarCheck' . out polytypic fvarCheck' :: f a b -> Maybe Int = case f of (Const Int) + g -> either ok err f -> err ok = Just err = const Nothing