relude-0.2.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")]

Minimal complete definition

one

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 :: * 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 #