Skip to content

Instantly share code, notes, and snippets.

@hdgarrood
Last active February 16, 2016 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hdgarrood/41c8f423a64ab218d681 to your computer and use it in GitHub Desktop.
Save hdgarrood/41c8f423a64ab218d681 to your computer and use it in GitHub Desktop.
`*>` is not `flip <*`!
module Main where
import Prelude
import Data.Monoid
import Control.Apply as Apply
import Control.Monad.Writer
import Control.Monad.Eff.Console (log, print)
main = do
print (runWriter (f "hi" Apply.<* f " world"))
print (runWriter (f "hi" Apply.*> f " world"))
let (*>) = flip Apply.(<*)
print (runWriter (f "hi" *> f " world"))
f :: forall a. (Monoid a) => a -> Writer a a
f x = do
tell x
pure x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment