[bitc-dev] Hybrid dependent typing

Mark Miller erights at gmail.com
Sun Jan 11 22:55:26 CST 2009


On Sun, Jan 11, 2009 at 8:44 PM, Tim Sweeney <Tim.Sweeney at epicgames.com> wrote:
> As in a current language, division could take a pair of rational numbers and return an option type containing a rational number, and the caller would be responsible for explicitly handling both cases of the result.  You could write this as:
>
>   divide(numerator:Rational,denominator:Rational):Maybe(Rational)
>
> Or, if the type system includes a feature equivalent to intersections and complements, it could take a pair of a rational number and a non-zero rational number, and return a rational number.  You might write this as:
>
>   divide(numerator:Rational,denominator:Rational!=0):Rational

Thanks Tim, that helps a lot. Yes, I could see how one could learn to
program in this way.

Jonathan & Swaroop, what are your current plans for division?


> P.S. Monads are a great idea for expressing operations analogous to iterators and database queries within a pure functional language.  The bad idea in Haskell was applying them to general imperative programing a la Haskell IO/ST monads.

Tim, could you elaborate on this? I've always found Monads hard to
understand. Shifting to this other context might help tremendously.
Thanks.

-- 
Text by me above is hereby placed in the public domain

    Cheers,
    --MarkM


More information about the bitc-dev mailing list