relude-0.4.0: Custom prelude from Kowainik

Copyright(c) 2016 Stephen Diehl
(c) 20016-2018 Serokell
(c) 2018 Kowainik
LicenseMIT
MaintainerKowainik <xrom.xkov@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Relude.Container.One

Description

Typeclass for creating structures from singleton element.

Synopsis

Documentation

class One x where Source #

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")]

Associated Types

type OneItem x Source #

Type of single element of the structure.

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 :: Type Source #

One ByteString Source # 
Instance details

Defined in Relude.Container.One

Associated Types

type OneItem ByteString :: Type Source #

One IntSet Source # 
Instance details

Defined in Relude.Container.One

Associated Types

type OneItem IntSet :: Type Source #

One Text Source # 
Instance details

Defined in Relude.Container.One

Associated Types

type OneItem Text :: Type Source #

Methods

one :: OneItem Text -> Text Source #

One Text Source # 
Instance details

Defined in Relude.Container.One

Associated Types

type OneItem Text :: Type Source #

Methods

one :: OneItem Text -> Text Source #

One [a] Source # 
Instance details

Defined in Relude.Container.One

Associated Types

type OneItem [a] :: Type Source #

Methods

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

One (NonEmpty a) Source # 
Instance details

Defined in Relude.Container.One

Associated Types

type OneItem (NonEmpty a) :: Type 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) :: Type 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) :: Type 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) :: Type 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) :: Type 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) :: Type 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) :: Type Source #

Methods

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