
Seems a bit of an ad hoc class, but maybe
class (Bounded a, Eq a) => Singular a where
singular :: a
With the constraint that singular = maxBound = minBound. Not going to let
you write an instance for (->) though, but maybe there are other ways to
get that with a different property.
On Tue, Feb 2, 2016 at 5:42 PM David Feuer
Or, alternatively, some common class that lets me express that a type is boring (i.e., inhabited by precisely one fully-defined value)? lens has Settable, whose law ensures the type involved has a boring representation (in the sense of representable functor), but is there a more fundamental way?
class Boring x where inhabitant :: x instance Boring () where inhabitant = () instance Boring (Proxy a) where inhabitant = Proxy instance Boring y => Boring (x -> y) where inhabitant = const inhabitant instance (Boring x, Boring y) => Boring (x, y) where inhabitant = (inhabitant, inhabitant) instance Boring x => Boring (Const x y) where inhabitant = Const inhabitant instance Boring x => Boring (Identity x) where inhabitant = Identity inhabitant ... _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe