Skip to content

Instantly share code, notes, and snippets.

@kana-sama
Created April 27, 2022 23:26
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 kana-sama/1d27d1b55e511c97d042def73f64d448 to your computer and use it in GitHub Desktop.
Save kana-sama/1d27d1b55e511c97d042def73f64d448 to your computer and use it in GitHub Desktop.
list dot
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
class ListDot t a | t -> a where
(•) :: ([a] -> [a]) -> a -> t
instance ListDot ([a] -> [a]) a where
(f • x) xs = f (x : xs)
instance ListDot [a] a where
f • x = f [x]
list :: [a] -> [a]
list = id
x :: [Int]
x =
list
• 1
• 2
• 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment