Snippets Collections
-- instances of the Ord typeclass have the ordering operators defined.
-- i.e ==, /= , <= etc
-- Ord a is a context
qsort :: Ord a => [a] => [a]
qsort [] = []
qsort (x:rest) = [v | v <- rest, v <= x] ++ [x] ++ [v | v <- rest, v > x]
data Maybe a = Nothing | Just a
data Either e a = Left e | Right a
data [a] = [] | a : [a]
newtype Identity a = Identity a
data Proxy a = Proxy
newtype Reader r a = Reader (r -> a))
newtype State s a = State (s -> (a, s))
newtype Parser a = Parser (String -> [(a,String)])
data IO a =  ¯\_(ツ)_/¯
quicksort :: Ord a => [a] -> [a] 
quicksort [] = [] 
quicksort (p:xs) = (quicksort lesser) ++ [p] ++ (quicksort greater) 
  where 
     lesser = filter (< p) xs 
     greater = filter (>= p) xs
bookmark
dashboard

Thu May 28 2020 22:12:31 GMT+0000 (UTC) https://blog.opemipo.dev/programming-language/functional-programming/haskell/2020/05/10/ope-meet-haskell.html

#haskell
bookmark
dashboard

Mon May 11 2020 05:08:32 GMT+0000 (UTC) http://haskell-for-readers.nomeata.de/

#haskell

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension