git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Rebindable do notation
commitb432994687265127f8301c9b1835a6d9a8da4875 authorPhil Freeman <paf31@cantab.net> dateSun 15 Mar 2015, 15:33 (12 years ago) parentda7b120
2 files changed+13−4
examples/passing/RebindableSyntax.purs+12 src/Language/PureScript/Sugar/DoNotation.hs+1−4
examples/passing/RebindableSyntax.pursnew file+12
@@ -0,0 +1,12 @@
1+module Main where
2+
3+example :: String
4+example = do
5+ "Do"
6+ " notation"
7+ " for"
8+ " monoids"
9+ where
10+ (>>=) x f = x <> f unit
11+
12+main = Debug.Trace.trace example
src/Language/PureScript/Sugar/DoNotation.hs+1−4
@@ -44,11 +44,8 @@ desugarDo d =
4444 let (f, _, _) = everywhereOnValuesM return replace return
4545 in f d
4646 where
47− prelude :: ModuleName
48− prelude = ModuleName [ProperName C.prelude]
49−
5047 bind :: Expr
51− bind = Var (Qualified (Just prelude) (Op (C.>>=)))
48+ bind = Var (Qualified Nothing (Op (C.>>=)))
5249
5350 replace :: Expr -> m Expr
5451 replace (Do els) = go els