Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Duck Wrapping. Parent comment
{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleInstances #-}
class Concatable a b where concat' :: a -> b -> a
instance Concatable [a] a where concat' l xs = l ++ [xs]
instance Concatable [a] [a] where concat' l xs = l ++ xs
a :: [Int] a = [1,2,3]
b :: Int b = 4
c :: [Int] c = [4]
-- Main> concat' a b
-- [1,2,3,4]
-- Main> concat' a c
There are no comments on this comment yet.
{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleInstances #-}
class Concatable a b where concat' :: a -> b -> a
instance Concatable [a] a where concat' l xs = l ++ [xs]
instance Concatable [a] [a] where concat' l xs = l ++ xs
a :: [Int] a = [1,2,3]
b :: Int b = 4
c :: [Int] c = [4]
-- Main> concat' a b
-- [1,2,3,4]
-- Main> concat' a c
-- [1,2,3,4]