Skip to content

Instantly share code, notes, and snippets.

@fumieval
Created January 22, 2015 05:23
Show Gist options
  • Save fumieval/a1f33ba6fe3088f2e215 to your computer and use it in GitHub Desktop.
Save fumieval/a1f33ba6fe3088f2e215 to your computer and use it in GitHub Desktop.
{-# LANGUAGE MultiParamTypeClasses
, FlexibleInstances
, TypeFamilies
, OverlappingInstances
, IncoherentInstances #-}
class WTF a b e where
($$) :: [a] -> e -> [b]
infixl 5 $$
instance (a ~ c, b ~ d) => WTF a b (c -> d) where
($$) = flip map
instance (a ~ b, b ~ c) => WTF a b c where
xs $$ x = xs ++ [x]
-- [] $$ 1 $$ 2 $$ 3 $$ (+10) --> [11,12,13]
-- [] $$ (+1) $$ (+2) $$ (+3) --> []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment