@@ -57,6 +57,8 @@ magicDo' = everywhereOnJS undo . everywhereOnJSTopDown convert
5757 convert :: JS -> JS
5858 -- Desugar return
5959 convert (JSApp (JSApp ret [val]) []) | isReturn ret = val
60+ -- Desugar pure
61+ convert (JSApp (JSApp pure' [val]) []) | isPure pure' = val
6062 -- Desugar >>
6163 convert (JSApp (JSApp bind [m]) [JSFunction Nothing ["_"] (JSBlock js)]) | isBind bind && isJSReturn (last js) =
6264 let JSReturn ret = last js in
@@ -78,6 +80,9 @@ magicDo' = everywhereOnJS undo . everywhereOnJSTopDown convert
7880 -- Check if an expression represents a monomorphic call to return for the Eff monad
7981 isReturn (JSApp retPoly [effDict]) | isRetPoly retPoly && isEffDict C.monadEffDictionary effDict = True
8082 isReturn _ = False
83+ -- Check if an expression represents a monomorphic call to pure for the Eff applicative
84+ isPure (JSApp purePoly [effDict]) | isPurePoly purePoly && isEffDict C.applicativeEffDictionary effDict = True
85+ isPure _ = False
8186 -- Check if an expression represents the polymorphic >>= function
8287 isBindPoly (JSAccessor prop (JSVar prelude)) = prelude == C.prelude && prop == identToJs (Op (C.>>=))
8388 isBindPoly (JSIndexer (JSStringLiteral bind) (JSVar prelude)) = prelude == C.prelude && bind == (C.>>=)
@@ -86,6 +91,10 @@ magicDo' = everywhereOnJS undo . everywhereOnJSTopDown convert
8691 isRetPoly (JSAccessor returnEscaped (JSVar prelude)) = prelude == C.prelude && returnEscaped == C.returnEscaped
8792 isRetPoly (JSIndexer (JSStringLiteral return') (JSVar prelude)) = prelude == C.prelude && return' == C.return
8893 isRetPoly _ = False
94+ -- Check if an expression represents the polymorphic pure function
95+ isPurePoly (JSAccessor pure' (JSVar prelude)) = prelude == C.prelude && pure' == C.pure'
96+ isPurePoly (JSIndexer (JSStringLiteral pure') (JSVar prelude)) = prelude == C.prelude && pure' == C.pure'
97+ isPurePoly _ = False
8998 -- Check if an expression represents a function in the Ef module
9099 isEffFunc name (JSAccessor name' (JSVar eff)) = eff == C.eff && name == name'
91100 isEffFunc _ _ = False