[Prev][Next][Index][Thread]

Wishlist: MixFix syntax



This is a repost of an earlier post from before there was an explicit
wishlist so it might make it onto the wishlist.

The idea was inspired by OBJs syntax. Something similar is also
available in Isabelle.

I always liked the possibility to declare infix operators, may we
extend this to mixfix? E.g.

> oper do _ on _ until _ od :: (a -> a) -> a -> (a -> Bool) -> a where
>      do f on x until p od =  until p f x

or

> oper if _ then _ else _ fi :: Bool -> a -> a -> a where
>      if c then t else e fi
>        = case c of
>           True -> t
>           False -> e

while this would (IMHO) already be nice, what I would really love
would be the ability to have a more general syntax for operator
definitions.

Having a type 

> newtype Subst = [Name :->: Term]
> instance Show Subst where
>   ...

and be able to write

> oper _ _ :: Subst -> Term -> Term where
>      sigma t = ...

or for 

> data Path a 
>  = Empty
>  | Path a (Path a)

> instance MonadPlus (Path a) ...

be able to write

> oper _;_ :: Path -> Path -> Path where
>      p ; q = p ++ q


Marko
-- 
Marko Schütz            marko@cs.uni-frankfurt.de
http://www.ki.informatik.uni-frankfurt.de/~marko/






Post to "haskell": haskell@dcs.gla.ac.uk