Created
April 27, 2022 23:26
-
-
Save kana-sama/1d27d1b55e511c97d042def73f64d448 to your computer and use it in GitHub Desktop.
list dot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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