git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge remote-tracking branch 'osa1/desugaringpatch'
commit815ff4007514ac58719b76eda266c88002c5aba1 authorPhil Freeman <paf31@cantab.net> dateThu 1 May 2014, 09:27 (13 years ago) parent10713bd03fae82
2 files changed+8−8
src/Language/PureScript/Environment.hs+5−5 src/Language/PureScript/Sugar/TypeClasses.hs+3−3
src/Language/PureScript/Environment.hs+5−5
@@ -73,11 +73,7 @@ data ForeignImportType
7373 -- |
7474 -- A foreign import which contains inline Javascript as a string literal
7575 --
76− | InlineJavascript
77− -- |
78− -- A type class dictionary member accessor import, generated during desugaring of type class declarations
79− --
80− | TypeClassAccessorImport deriving (Show, Eq, Data, Typeable)
76+ | InlineJavascript deriving (Show, Eq, Data, Typeable)
8177
8278-- |
8379-- The kind of a name
@@ -88,6 +84,10 @@ data NameKind
8884 --
8985 = Value
9086 -- |
87+ -- A type class dictionary member accessor import, generated during desugaring of type class declarations
88+ --
89+ | TypeClassAccessorImport
90+ -- |
9191 -- A foreign import
9292 --
9393 | Extern ForeignImportType
src/Language/PureScript/Sugar/TypeClasses.hs+3−3
@@ -143,9 +143,9 @@ typeClassDictionaryDeclaration name args implies members =
143143
144144typeClassMemberToDictionaryAccessor :: ModuleName -> ProperName -> [String] -> Declaration -> Declaration
145145typeClassMemberToDictionaryAccessor mn name args (TypeDeclaration ident ty) =
146− ExternDeclaration TypeClassAccessorImport ident
147− (Just (JSFunction (Just $ identToJs ident) ["dict"] (JSBlock [JSReturn (JSIndexer (JSStringLiteral (identToProperty ident)) (JSVar "dict"))])))
148− (moveQuantifiersToFront (quantify (ConstrainedType [(Qualified (Just mn) name, map TypeVar args)] ty)))
146+ ValueDeclaration ident TypeClassAccessorImport [] Nothing $
147+ TypedValue False (Abs (Left $ Ident "dict") (Accessor (runIdent ident) (Var $ Qualified Nothing (Ident "dict")))) $
148+ moveQuantifiersToFront (quantify (ConstrainedType [(Qualified (Just mn) name, map TypeVar args)] ty))
149149typeClassMemberToDictionaryAccessor mn name args (PositionedDeclaration pos d) =
150150 PositionedDeclaration pos $ typeClassMemberToDictionaryAccessor mn name args d
151151typeClassMemberToDictionaryAccessor _ _ _ _ = error "Invalid declaration in type class definition"