DatatypeContexts in data types and data families
Does datatype contexts only apply for non-phantom variables? Figured I'd ask
{-# Language DatatypeContexts, TypeFamilies #-}
-- F :: Foo a b
data (a ~ b) => Foo a b = F
and
{-# Language DatatypeContexts, KindSignatures, DatatypeContexts, DataKinds, TypeFamilies #-}
data N = O | S N
-- FO :: Fin (S n) n' O
data family Fin (n::N) (a::N) (b::N)
data instance (n ~ n') => Fin (S n) n' O = FO
It surprised me to see the first two of these (yes I know, datatype contexts):
-- F :: x -> Foo x x
data (a ~ b) => Foo a b = F a
-- F :: x -> Foo x x
data (a ~ b) => Foo a b = F b
-- F :: x -> x -> Foo x x
data (a ~ b) => Foo a b = F a b
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.0.1 |
| Type | Task |
| TypeOfFailure | OtherFailure |
| Priority | lowest |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |