@@ -26,19 +26,11 @@ newtype DSLMonad (i ∷ # !) a = DSL (Writer (Array (Tuple String Foreign)) a)
2626unDSL ∷ ∀ i a . DSLMonad i a → Writer (Array (Tuple String Foreign )) a
2727unDSL (DSL m) = m
2828
29- instance functorDSL ∷ Functor (DSLMonad i ) where
30- map f (DSL o) = DSL $ map f o
31-
32- instance applyDSL ∷ Apply (DSLMonad i ) where
33- apply (DSL f) (DSL o) = DSL $ apply f o
34-
35- instance applicativeDSL ∷ Applicative (DSLMonad i ) where
36- pure = DSL <<< pure
37-
38- instance bindDSL ∷ Bind (DSLMonad i ) where
39- bind (DSL o) f = DSL $ o >>= unDSL <<< f
40-
41- instance monadDSL ∷ Monad (DSLMonad i )
29+ derive newtype instance functorDSL ∷ Functor (DSLMonad i )
30+ derive newtype instance applyDSL ∷ Apply (DSLMonad i )
31+ derive newtype instance applicativeDSL ∷ Applicative (DSLMonad i )
32+ derive newtype instance bindDSL ∷ Bind (DSLMonad i )
33+ derive newtype instance monadDSL ∷ Monad (DSLMonad i )
4234
4335type DSL i = DSLMonad i Unit
4436
@@ -50,15 +42,15 @@ get k (DSL cs) =
5042 F .foldl (foldFn k) Nothing $ execWriter cs
5143 where
5244 foldFn ∷ String → Maybe Foreign → Tuple String Foreign → Maybe Foreign
53- foldFn k Nothing (Tuple kk f) | k == kk = Just f
45+ foldFn k' Nothing (Tuple kk f) | k' == kk = Just f
5446 foldFn _ a _ = a
5547
5648lastWithKeys ∷ ∀ i f . F.Foldable f ⇒ f String → DSL i → Maybe Foreign
5749lastWithKeys ks (DSL cs) =
5850 F .foldl (foldFn ks) Nothing $ Arr .reverse $ execWriter cs
5951 where
6052 foldFn ∷ f String → Maybe Foreign → Tuple String Foreign → Maybe Foreign
61- foldFn ks Nothing (Tuple kk f) | F .elem kk ks = Just f
53+ foldFn ks' Nothing (Tuple kk f) | F .elem kk ks' = Just f
6254 foldFn _ a _ = a
6355
6456applyOnePair ∷ Tuple String Foreign → Foreign → Foreign
0 commit comments