Mercurial > urweb
annotate lib/ur/option.ur @ 921:ae0110465421
Don't replace <sc> in blob returns; optimize more 'option' pattern matches; detect more opportunities for 'let' inlining
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Wed, 09 Sep 2009 08:00:45 -0400 |
parents | 0d30e6338c65 |
children | da3ec6014d2f |
rev | line source |
---|---|
adamc@841 | 1 datatype t = datatype Basis.option |
adamc@841 | 2 |
adamc@846 | 3 fun eq [a] (_ : eq a) = |
adamc@846 | 4 mkEq (fn x y => |
adamc@846 | 5 case (x, y) of |
adamc@846 | 6 (None, None) => True |
adamc@846 | 7 | (Some x, Some y) => x = y |
adamc@846 | 8 | _ => False) |
adamc@846 | 9 |
adamc@841 | 10 fun isSome [a] x = |
adamc@841 | 11 case x of |
adamc@841 | 12 None => False |
adamc@841 | 13 | Some _ => True |
adamc@844 | 14 |
adamc@844 | 15 fun mp [a] [b] f x = |
adamc@844 | 16 case x of |
adamc@844 | 17 None => None |
adamc@844 | 18 | Some y => Some (f y) |
adamc@846 | 19 |
adamc@846 | 20 fun bind [a] [b] f x = |
adamc@846 | 21 case x of |
adamc@846 | 22 None => None |
adamc@846 | 23 | Some y => f y |