[Haskell-cafe] ANN: package Boolean: Generalized booleans
conal at conal.net
Tue Jun 30 11:24:04 EDT 2009
I like your extensions of generalized booleans to other common Haskell
I also prefer using type families to fundeps. In this case I didn't because
of some awkwardness with vector operations, but I'm going to try again.
I'm confused about your particular fundep choice. For instance,
class Bool f r | f -> r where
bool :: r -> r -> f -> r
false :: f
true :: f
Do you *really* mean that the boolean type f determines the value type r?
Regards, - Conal
On Tue, Jun 30, 2009 at 1:34 AM, Sebastiaan Visser <sfvisser at cs.uu.nl>wrote:
> On Jun 30, 2009, at 2:44 AM, Conal Elliott wrote:
>> I just uploaded a new package  for generalized booleans, which provides
>> type classes with generalizations of boolean values & operations,
>> if-then-else, Eq and Ord. These values & types come up for me with every
>> new deep DSEL, and I think they do for others as well. The design space has
>> some tricky trade-offs, and I'm not positive I've found the optimum yet.
>> Users & comments are very welcome. Please direct discussion to the
>> haskell-cafe list (rather than haskell list).
> Good work!
> Together with Tom Lokhorst I've been working on something very similar.
> We've been using a rather consistent way of eliminating data structures that
> scales well to other data types. Although we are also using functional
> dependencies I think we might want to change them to type families.
>> class Bool f r | f -> r where
>> bool :: r -> r -> f -> r
>> false :: f
>> true :: f
>> class Maybe f a r | f -> a, f -> r where
>> maybe :: r -> (a -> r) -> f a -> r
>> nothing :: f a
>> just :: a -> f a
>> class Either f a b r | f -> a, f -> b, f -> r where
>> either :: (a -> r) -> (b -> r) -> f a b -> r
>> left :: a -> f a b
>> right :: b -> f a b
> Currently we have a very limited and somewhat messy code base on github
> which shows how to instantiate these types to get back the original Haskell
> EDSL. Next target will, off course, be Objective C. :-)
> Our code is not yet release worthy and probably never will be in this form.
> But is would be very nice to see some kind of generalized prelude evolving.
> : http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Boolean
>> - Conal
> Sebastiaan Visser
>  http://github.com/tomlokhorst/AwesomePrelude/tree/master
>  http://github.com/sebastiaanvisser/frp-js
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe