Copyright | (c) 2016 Stephen Diehl (c) 2016-2018 Serokell (c) 2018-2019 Kowainik |
---|---|
License | MIT |
Maintainer | Kowainik <xrom.xkov@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
Documentation
Typeclass for data types that can be created from one element.
>>>
one True :: [Bool]
[True]>>>
one 'a' :: Text
"a">>>
one (3, "hello") :: HashMap Int String
fromList [(3,"hello")]
Laws:
single-size
:∀ x . size (one x) ≡ 1
(where size
is a specific function for each container that returns the size of
this container)
Instances
One ShortByteString Source # | Create singleton
ShortByteString.length (one x) == 1 |
Defined in Relude.Container.One type OneItem ShortByteString Source # | |
One ByteString Source # | Create singleton lazy
LByteString.length (one x) == 1 |
Defined in Relude.Container.One type OneItem ByteString Source # one :: OneItem ByteString -> ByteString Source # | |
One ByteString Source # | Create singleton strict
ByteString.length (one x) == 1 |
Defined in Relude.Container.One type OneItem ByteString Source # one :: OneItem ByteString -> ByteString Source # | |
One IntSet Source # | Create singleton
IntSet.size (one x) == 1 |
One Text Source # | Create singleton lazy
LText.length (one x) == 1 |
One Text Source # | Create singleton strict
Text.length (one x) == 1 |
One [a] Source # | Allows to create a singleton list. You might prefer function with name
length (one @[Int] x) == 1 |
One (NonEmpty a) Source # | Allows to create singleton
length (one @(NonEmpty Int) x) == 1 |
One (IntMap v) Source # | Create singleton
length (one @(IntMap String) x) == 1 |
One (Seq a) Source # | Create singleton
length (one @(Seq Int) x) == 1 |
One (Set a) Source # | Create singleton
length (one @(Set Int) x) == 1 |
Hashable a => One (HashSet a) Source # | Create singleton
length (one @(HashSet Int) x) == 1 |
One (Map k v) Source # | Create singleton
length (one @(Map Int String) x) == 1 |
Hashable k => One (HashMap k v) Source # | Create singleton
length (one @(HashMap Int String) x) == 1 |