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