Last active
December 21, 2022 20:05
-
-
Save ramirez7/1fbcc07cf838bac7447ef7a566f9469c to your computer and use it in GitHub Desktop.
TF effectively returning c => t
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE KindSignatures #-} | |
| {-# LANGUAGE RankNTypes #-} | |
| {-# LANGUAGE TypeFamilies #-} | |
| {-# LANGUAGE ConstraintKinds #-} | |
| import Data.Kind (Type, Constraint) | |
| data CT (c :: Type -> Constraint) t | |
| type family TF t :: Type where | |
| TF Int = CT Show Int | |
| TF String = CT Read String | |
| useIt :: forall t c a. TF t ~ CT c t => c a => a -> t | |
| useIt = error "I can't actually do anything with this type signature" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment