Skip to content

Instantly share code, notes, and snippets.

@wangbj
Created January 20, 2016 23:43
Show Gist options
  • Save wangbj/c5cc58bd3e5a62b37119 to your computer and use it in GitHub Desktop.
Save wangbj/c5cc58bd3e5a62b37119 to your computer and use it in GitHub Desktop.
showIntBase2 = reverse . concatMap show . un
where un = unfoldr go
go = uncurry (*>) . (&&&) (guard . (>0)) (Just . swap . (`quotRem` 2))
-- > showIntBase2 12
-- "1100"
@wangbj
Copy link
Author

wangbj commented Jan 20, 2016

apply2 f g h x = f (g x) (h x) ==>
apply2' f g h = uncurry f . (&&&) g h

sequenceT2 (a, b) = a >> b ~=
uncurry (>>)
or
uncurry (*>)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment