Skip to content

Instantly share code, notes, and snippets.

@DimaD
Last active August 29, 2015 14:02
Show Gist options
  • Save DimaD/06fa2284e9d8a90442f8 to your computer and use it in GitHub Desktop.
Save DimaD/06fa2284e9d8a90442f8 to your computer and use it in GitHub Desktop.
Prelude> :m Control.Monad
Prelude Control.Monad> join (,) 1
(1,1)
-- So it produces pairs somehow. Let's look at type signatures
Prelude Control.Monad> :t join
join :: Monad m => m (m a) -> m a
Prelude Control.Monad> :t (,)
(,) :: a -> b -> (a, b)
Prelude Control.Monad> :t join (,)
join (,) :: a -> (a, a)
-- Does not make any sense by looking at this.
-- Explanation of how type checker deduces what to do by Edward Kmett is here:
-- http://www.reddit.com/r/haskell/comments/1olk04/the_magic_of_join/cct4kaz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment