[Haskell-cafe] Current research on overlapping/closed type families?

Ryan Ingram ryani.spam at gmail.com
Fri Jan 23 21:51:13 EST 2009


Of course.  I was just wondering if anyone was looking into the
implications of said features :)

For example, with this instance, if "a" is a type variable, you can't
reduce "IsFunction a" to HFalse, because "a" might be "b -> c" for
some b, c.

Whereas in the current formulation, you can treat the declaration as a
rewrite rule without considering how variables are instantiated.  Of
course, this makes IsFunction far less useful; if you were using it
to, for example, define automatic currying and uncurrying of
n-argument functions, it matters whether the result is higher-order or
not, which is somewhat unsatisfying.

  -- ryan

On Fri, Jan 23, 2009 at 6:06 PM, Simon Peyton-Jones
<simonpj at microsoft.com> wrote:
> Provided all the overlapping instances are supplied together, as you suggest, I think what you say makes perfect sense and does not threaten soundness.
>
> But we have not yet implemented the idea yet.  First priority is to get type families working properly, and in conjunction with type classes.  Then we can move on to adding features.
>
> Simon
>
> | -----Original Message-----
> | From: haskell-cafe-bounces at haskell.org [mailto:haskell-cafe-
> | bounces at haskell.org] On Behalf Of Ryan Ingram
> | Sent: 19 January 2009 23:24
> | To: Haskell Cafe
> | Subject: [Haskell-cafe] Current research on overlapping/closed type families?
> |
> | What's the status of overlapping/closed type families?  I'm interested
> | in something like the following, which can currently be implemented in
> | GHC with Oleg-magic using functional dependencies, but cannot, to my
> | knowledge, be implemented with type families:
> |
> | data HTrue = HTrue
> | data HFalse = HFalse
> |
> | type family IsFunction f
> |
> | {- not legal in GHC6.10 -}
> | type instances
> |    IsFunction (a -> b) = HTrue
> |    IsFunction a = HFalse
> |
> |   -- ryan
> | _______________________________________________
> | Haskell-Cafe mailing list
> | Haskell-Cafe at haskell.org
> | http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>


More information about the Haskell-Cafe mailing list