relude-0.1.1: Custom prelude from Kowainik

Safe HaskellNone
LanguageHaskell2010

Relude.Container.One

Description

Typeclass for creating structures from singleton element.

Synopsis

Documentation

class One x where Source #

Type class for types that can be created from one element. singleton is lone name for this function. Constructions of different type differ: :[] for lists, two arguments for Maps. Also some data types are monomorphic.

>>> one True :: [Bool]
[True]
>>> one 'a' :: Text
"a"
>>> one (3, "hello") :: HashMap Int String
fromList [(3,"hello")]

Minimal complete definition

one

Associated Types

type OneItem x Source #

Methods

one :: OneItem x -> x Source #

Create a list, map, Text, etc from a single element.

Instances
One ByteString Source # 
Instance details

Defined in Relude.Container.One

Associated Types

type OneItem ByteString :: * Source #

One ByteString Source # 
Instance details

Defined in Relude.Container.One

Associated Types

type OneItem ByteString :: * Source #

One IntSet Source # 
Instance details

Defined in Relude.Container.One

Associated Types

type OneItem IntSet :: * Source #

One Text Source # 
Instance details

Defined in Relude.Container.One

Associated Types

type OneItem Text :: * Source #

Methods

one :: OneItem Text -> Text Source #

One Text Source # 
Instance details

Defined in Relude.Container.One

Associated Types

type OneItem Text :: * Source #

Methods

one :: OneItem Text -> Text Source #

One [a] Source # 
Instance details

Defined in Relude.Container.One

Associated Types

type OneItem [a] :: * Source #

Methods

one :: OneItem [a] -> [a] Source #

One (NonEmpty a) Source # 
Instance details

Defined in Relude.Container.One

Associated Types

type OneItem (NonEmpty a) :: * Source #

Methods

one :: OneItem (NonEmpty a) -> NonEmpty a Source #

One (IntMap v) Source # 
Instance details

Defined in Relude.Container.One

Associated Types

type OneItem (IntMap v) :: * Source #

Methods

one :: OneItem (IntMap v) -> IntMap v Source #

One (Seq a) Source # 
Instance details

Defined in Relude.Container.One

Associated Types

type OneItem (Seq a) :: * Source #

Methods

one :: OneItem (Seq a) -> Seq a Source #

One (Set v) Source # 
Instance details

Defined in Relude.Container.One

Associated Types

type OneItem (Set v) :: * Source #

Methods

one :: OneItem (Set v) -> Set v Source #

Hashable v => One (HashSet v) Source # 
Instance details

Defined in Relude.Container.One

Associated Types

type OneItem (HashSet v) :: * Source #

Methods

one :: OneItem (HashSet v) -> HashSet v Source #

One (Map k v) Source # 
Instance details

Defined in Relude.Container.One

Associated Types

type OneItem (Map k v) :: * Source #

Methods

one :: OneItem (Map k v) -> Map k v Source #

Hashable k => One (HashMap k v) Source # 
Instance details

Defined in Relude.Container.One

Associated Types

type OneItem (HashMap k v) :: * Source #

Methods

one :: OneItem (HashMap k v) -> HashMap k v Source #