Created
December 17, 2023 19:05
-
-
Save MrQubo/67a3b2a6f9ec3d9ef12e261d7b2a41c8 to your computer and use it in GitHub Desktop.
Implicit constraint on associated type family
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 | |
DerivingStrategies, | |
TypeFamilies, | |
PatternSynonyms, | |
DataKinds | |
#-} | |
class (Show (SymbolIdent' p)) => IdentParam p where | |
data SymbolIdent' p | |
data SymbolIdent p where | |
SymbolIdent :: IdentParam p => SymbolIdent' p -> SymbolIdent p | |
deriving stock instance Show (SymbolIdent p) | |
data IdentParamName | |
instance IdentParam IdentParamName where | |
newtype instance SymbolIdent' IdentParamName = SymbolName' String | |
deriving stock (Show) | |
pattern SymbolName s = SymbolIdent (SymbolName' s) | |
data IdentParamId | |
instance IdentParam IdentParamId where | |
newtype instance SymbolIdent' IdentParamId = SymbolId' Int | |
deriving stock (Show) | |
pattern SymbolId s = SymbolIdent (SymbolId' s) | |
data Struct p = Struct (SymbolIdent p) | |
deriving stock Show |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment