[Haskell-cafe] Associated types, kind constraints & typelits

Nicolas Trangez nicolas at incubaid.com
Mon Jan 6 17:21:13 UTC 2014


On Mon, 2014-01-06 at 09:15 -0800, Nathan Howell wrote:
> This requires -XScopedTypeVariables and some constraints:
> 
> tOf :: forall a . (SingI (T a), C a) => a -> Integer
> tOf _ = fromSing $ (sing :: Sing (T a))

Wonderful, thanks. I tried using ScopedTypeVariables, but "SingI Nat (T
a)" didn't work out, although the compiler error hinted in that
direction.

Thanks,

Nicolas



More information about the Haskell-Cafe mailing list