git.iko.soy/rowtype-yoga/purescript-native
on 06e4332 help sign in
45 lines 1.6 kB history raw
1module Language.PureScript.TypeClassDictionaries where
3import Language.PureScript.Names
4import Language.PureScript.Types
6-- |
7-- Data representing a type class dictionary which is in scope
8--
9data TypeClassDictionaryInScope
10 = TypeClassDictionaryInScope {
11 -- | The identifier with which the dictionary can be accessed at runtime
12 tcdName :: Qualified Ident
13 -- | How to obtain this instance via superclass relationships
14 , tcdPath :: [(Qualified (ProperName 'ClassName), Integer)]
15 -- | The name of the type class to which this type class instance applies
16 , tcdClassName :: Qualified (ProperName 'ClassName)
17 -- | The types to which this type class instance applies
18 , tcdInstanceTypes :: [Type]
19 -- | Type class dependencies which must be satisfied to construct this dictionary
20 , tcdDependencies :: Maybe [Constraint]
21 }
22 deriving (Show, Read)
24-- |
25-- A simplified representation of expressions which are used to represent type
26-- class dictionaries at runtime, which can be compared for equality
27--
28data DictionaryValue
29 -- |
30 -- A dictionary which is brought into scope by a local constraint
31 --
32 = LocalDictionaryValue (Qualified Ident)
33 -- |
34 -- A dictionary which is brought into scope by an instance declaration
35 --
36 | GlobalDictionaryValue (Qualified Ident)
37 -- |
38 -- A dictionary which depends on other dictionaries
39 --
40 | DependentDictionaryValue (Qualified Ident) [DictionaryValue]
41 -- |
42 -- A subclass dictionary
43 --
44 | SubclassDictionaryValue DictionaryValue (Qualified (ProperName 'ClassName)) Integer
45 deriving (Show, Read, Ord, Eq)