
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
to be the same size?
Thanks,
Greg
On Wed, Sep 11, 2013 at 2:18 AM, Simon Hengel
On Tue, Sep 10, 2013 at 11:02:19PM +0100, Oliver Charles wrote:
I would like to propose that the following is added to Data.Bool in base:
bool :: a -> a -> Bool -> a bool f _ False = f bool _ t True = t
+1 _______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries