Skip to content

Commit

Permalink
Copy in the <~> combinator from starlight.
Browse files Browse the repository at this point in the history
  • Loading branch information
robrix committed Oct 19, 2020
1 parent 440bf55 commit 57ecc43
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Facet/REPL.hs
Expand Up @@ -15,7 +15,7 @@ import Control.Carrier.Parser.Church
import Control.Carrier.Reader
import Control.Carrier.Readline.Haskeline
import Control.Carrier.State.Church
import Control.Effect.Lens (use, (%=), (.=))
import Control.Effect.Lens (use, (%=), (.=), (<~))
import Control.Effect.Parser.Source (Source(..), sourceFromString)
import Control.Lens (Getting, Lens', ix, lens)
import Control.Monad.IO.Class
Expand Down Expand Up @@ -192,3 +192,9 @@ elab src = runReader (span src) . L.runState env_ . rethrowElabErrors src
lens ~> act = use lens >>= act

infixr 2 ~>

-- | Compose a lens onto either side of a Kleisli arrow and run it on the 'State'.
(<~>) :: Has (State s) sig m => Lens' s a -> (a -> m a) -> m ()
lens <~> act = lens <~ lens ~> act

infixr 2 <~>

0 comments on commit 57ecc43

Please sign in to comment.