[Haskell-cafe] If you'd design a Haskell-like language, what would you do different?
Chris Wong
chrisyco+haskell-cafe at gmail.com
Wed Dec 21 00:10:24 CET 2011
On Wed, Dec 21, 2011 at 10:53 AM, Matthew Farkas-Dyck
<strake888 at gmail.com> wrote:
> With GHC 7.0.3:
>
> $ cat test.hs
> class ℝ a where {
> test :: a;
> };
>
> (∈) :: Eq a => a -> [a] -> Bool;
> x ∈ (y:ys) = x == y || x ∈ ys;
>
> main = putStrLn "Two of three ain't bad (^_~)";
> $ runhaskell test.hs
> Two of three ain't bad (^_~)
> $
Why not expand it even further?
class Monoid m where
(•) :: m -> m -> m
(∅) :: m
(∈) :: (Foldable t, Eq a) => a -> t a -> Bool
(∘) :: (b -> c) -> (a -> b) -> (a -> c)
(∧) :: Bool -> Bool -> Bool
etc.
We can write a whole Haskell library full of these aliases --
"syntactic-heroin" perhaps? ;)
(http://www.haskell.org/haskellwiki/Syntactic_sugar/Cons#Syntactic_heroin)
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list