<div dir="ltr">Seems a bit of an ad hoc class, but maybe<div><br></div><div>class (Bounded a, Eq a) => Singular a where</div><div> singular :: a</div><div><br></div><div>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.</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Feb 2, 2016 at 5:42 PM David Feuer <<a href="mailto:david.feuer@gmail.com">david.feuer@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">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?</p>
<p dir="ltr">class Boring x where<br>
inhabitant :: x<br>
instance Boring () where<br>
inhabitant = ()<br>
instance Boring (Proxy a) where<br>
inhabitant = Proxy<br>
instance Boring y => Boring (x -> y) where<br>
inhabitant = const inhabitant<br>
instance (Boring x, Boring y) => Boring (x, y) where<br>
inhabitant = (inhabitant, inhabitant)<br>
instance Boring x => Boring (Const x y) where<br>
inhabitant = Const inhabitant<br>
instance Boring x => Boring (Identity x) where<br>
inhabitant = Identity inhabitant<br>
...</p>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div>