æšæ¥ã®
https://haskell-jp.slack.com/archives/C4M4TT8JJ/p1526345560000259 ã§ãfumiããããå©èšãåããŠããåã¬ãã«ãªã¹ãããèŠçŽ ãåãé€ãåæRemove :: k -> [k] -> [k]ããæžããŠãããšãããªãã§ãã
å€ã¬ãã«ã®é¢æ°ãå²ãšæçŽã«ç¿»èš³ããŠãã㪠:point_down: ãšãããŸã§æžããŸããïŒããã®ã©ã€ãã©ãªãŒã§å®è£
æžã¿ãããªãã®ãããšããæ°ãããŸããïŒã
type family ConsUnless (b :: Bool) (x :: k) (xs :: [k]) :: [k] where
ConsUnless False x xs = (x ': xs)
ConsUnless True _ xs = xs
type family Reject (p :: (k -> Bool)) (xs :: [k]) :: [k] where
Reject p '[] = '[]
Reject p (x ': xs) = ConsUnless (p x) x (Reject p xs)
type family Same (x :: k) (y :: k) :: Bool where
Same x x = 'True
Same x y = 'False
type family Without (x :: k) (xs :: [k]) :: [k] where
Without x xs = Reject (Same x) xs
ã§ãã³ã³ãã€ã«ãããšãªãã
⢠The type family âSameâ should have 2 arguments, but has been given 1
⢠In the equations for closed type family âWithoutâ
In the type family declaration for âWithoutâ
ãšãããšã©ãŒãåºãŸãã
Same ã2ã€åŒæ°ããšãã®ã¯ãããšããŠã
Reject ã®ç¬¬äžåŒæ°ãåŒæ°ã1ã€ãšãåæããšããã宣èšããŠããã®ã§ã
Same x ãšããã°ããããããªãããšæããã®ã§ããããªãã§ãšã©ãŒã«ãªã£ãŠããŸãã®ã§ããããïŒ