Skip to content

Instantly share code, notes, and snippets.

@WillNess
Last active December 17, 2015 17:49
Show Gist options
  • Save WillNess/5649184 to your computer and use it in GitHub Desktop.
Save WillNess/5649184 to your computer and use it in GitHub Desktop.
fix$(<$>)<$>(:)<*>((<$>((:[{- thor's mother -}])<$>))(=<<)<$>(*)<$>(*2))$1
fix $ (<$>) <$> (:) <*>
( (<$> ((:[]) <$>) ) (=<<)
-- |----\~~~~~~~~~/-|
<$>(*)<$>(*2)
)
$ 1
fix $ (fmap . (:)) <*>
( ((=<<) <$> (fmap (:[])) )
<$>(*)<$>(*2)
)
$ 1
fix ( ( (fmap . (:)) <*>
( (=<<) . (fmap (:[])) . (*) . (*2) )
)
1 )
fmap :: (a->b) -> (r->a) -> (r->b) -- fmap f g x = f (g x) = (f . g) x
<*> :: (r->a->b) -> (r->a) -> (r->b) -- (f<*>g) x = f x (g x)
fix ( (fmap . (:)) 1
( ((=<<) . (fmap (:[])) . (*) . (*2)) 1 ) )
fix ( (fmap (1:))
( (=<<) ( (fmap (:[])) ( (*) ( (*2) 1 ) ) ) ) )
fix ( fmap (1:)
( (=<<) ( (fmap (:[])) ( (*) 2 ) ) ) )
fix ( fmap (1:)
( (=<<) ( fmap (:[]) (2*) ) ) )
fix ( (1:) .
( (=<<) ((:[]) . (2*)) ) )
x where x = ( (1:) . ( ((:[]) . (2*)) =<<) ) x
x where x = (1:) ( ( ((:[]) . (2*)) =<<) x ) -- x :: Num a => [a]
xs where xs = 1 : ( (\x->[2*x]) =<< xs) -- xs :: Num a => [a]
xs where xs = 1 : map (2*) xs
---------------------------------
by olsner:
fix$(<$>)<$>(:)<*>((<$>((:[{- Jörð -}])<$>))(=<<)<$>(*)<$>(>>=)(+)($))$1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment