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