I don't like a total function to be implemented using a non-total function (!!). Additionally your implementation relies on fromEnum True == 1, which is a bad thing.
On Wed, 11 Sep 2013, Greg Fitzgerald wrote:
I'd prefer something more like:
mux :: Enum b => [a] -> b -> a
mux xs x = xs !! fromEnum x
so then 'bool' could be implemented as:
bool :: a -> a -> Bool -> a
bool f t = mux [f, t]
but 'mux' needs a stronger type signature. The size of the enum is
known at compile-time. Is there any way to constrain the input list
_______________________________________________
Libraries mailing list
Libraries@haskell.org
http://www.haskell.org/mailman/listinfo/libraries