Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Homomorphic operation from element to structured number
- class Singleton f where
Documentation
class Singleton f where Source #
This class could also be called replicate. Looking forward, however, it may be useful to consider a Representable such as
VectorThing a = Vector a | Single a | Zero
and then
singleton a = Single a singleton zero = Zero
short-circuiting an expensive computation. As the class action then doesn't actually involve replication, it would be mis-named.