> {-# LANGUAGE DataKinds, TypeOperators, KindSignatures, GADTs, ConstraintKinds, TypeFamilies, UndecidableInstances #-}
>
> import GHC.TypeLits
> import Data.Constraint
> import Data.Proxy
> data Proof2 :: (Nat -> Constraint) -> * where
> Proof2 :: c n => Proxy n -> Proof2 c
>
> type family LessThen255 n :: Constraint where
> LessThen255 f = (f <= 255)
>
> one :: LessThen255 n => Proxy n -> Proof2 LessThen255
> one = Proof2
Выдает очень неожиданное
Min.lhs:14:9:
Could not deduce (LessThen255 n) arising from a use of ‘Proof2’
from the context (LessThen255 n)
bound by the type signature for
one :: (LessThen255 n) => Proxy n -> Proof2 LessThen255
куда копать?
P.S. изменение на
> data Proof2 :: (Nat -> Constraint) -> Nat -> * where
> Proof2 :: c n => Proxy n -> Proof2 c n
(избавились от экзистенциализма) не помогает