numhask-0.2.2.0: numeric classes

Safe HaskellSafe
LanguageHaskell2010

NumHask.Algebra.Singleton

Description

Homomorphic operation from element to structured number

Synopsis

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.

Minimal complete definition

singleton

Methods

singleton :: a -> f a Source #