IntSets of TypeRepKeys!-)
IntSet's are only possible in 6.8 due to API changes :-)
infinite possibilities of combining type-level programming
with efficient execution!-)
I couldn't quite figure out how to make a type-dependent CAF in the class
instances, as your paper suggests, so I made my CAF at the top-level
instead
instance Domain a b where
domain = \_ -> res
where res = ... the computed domain ...
class Domain a b where
domain :: (a,b) -> IntSet
That should work.
Yes, that is roughly what I tried but, unfortunately, it is very
fragile against (lack of) optimisations, and I haven't yet figured
out what small variation prevents it from working in my real
code, when it works in my slightly simplified tests..
My current guess is that this works when res is floated out,
and that something prevents this in my real code. Apart from
fixing my code, it would be nice to find a way to guarantee
that this works, by suitable use of pragmas.
The query and scheme change only minimally, to add the domain
of the query function, and to shortcut the scheme if there are no
domain members in the substructure types:
I really don't like this approach. You specify two things, with an
intricate relationship between them, and if you get it wrong its not a
type error - the operation just gives the wrong result. I think it
overcomplicates the type, in ways that aren't really necessary.
Of course not. In practice, you'd want to pair the function with
its domain, and compute the latter implicitly when converting
functions into queries. This optimisation shouldn't be visible to
the end user, but be correct by construction.
Claus
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc