On Wed, 2007-02-07 at 12:25 +0100, Rhythmic Fistman wrote:
> > Date: Wed, 07 Feb 2007 13:41:37 +1100
> > From: skaller <[EMAIL PROTECTED]>

> So I guess that makes me a user. Granted it's not much felix code,
> but it replaces MILLIONS of lines of unmaintainable c++.
> 
> P.S. What's a monad?

http://www.haskell.org/tutorial/monads.html

But roughly it is this function:

typeclass Monad [M: TYPE->TYPE] {
  virtual fun thn[a,b]: M a * (a -> M b) -> M b;
...

which is easily understood in the simple case of 
the Maybe monad:

instance Monad [the Maybe] {
  fun thn[a,b] (x:Maybe a, f:a -> Maybe b) =>
    match x with
    | None[a] => None[b]
    | Some ?x => f x
    endmatch
  ;

  fun ret[a](x:a):Maybe a => Some x;
  fun fail[a] (x:string): Maybe a => None[a];
}


-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to