[Haskell-cafe] Reflection functional dependency as an associated type?
Richard Eisenberg
eir at cis.upenn.edu
Wed Oct 1 23:55:24 UTC 2014
Type families and functional dependencies play very poorly together. The internal GHC mechanisms to implement them are basically entirely separate, so I'm not surprised that this fails. I do think that what you want is type-safe, but just not supported right now.
Richard
On Oct 1, 2014, at 6:14 PM, Brandon Moore <brandon_m_moore at yahoo.com> wrote:
> I was trying to make a bridge like this
>
> class MonadStateTF m where
> type StateOf m :: *
> instance (MonadState s m) => MonadStateTF m where
> type StateOF m = s
>
> to allow writing constraints on state monads without a dangling type parameter
> type NumMonad m = (MonadStateTF m, Num (StateOf m))
>
> Unfortunately, the declaration type StateOF m = s
> complains that "s" isn't mentioned on the left hand side rather
> than somehow making use of the fundep.
>
> Brandon
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20141001/7afc2dc1/attachment.html>
More information about the Haskell-Cafe
mailing list