sdp-0.2.1.1: Simple Data Processing
Copyright(c) Andrey Mulik 2020-2021
LicenseBSD-style
Maintainerwork.a.mulik@gmail.com
Portabilitynon-portable (GHC extensions)
Safe HaskellTrustworthy
LanguageHaskell2010

SDP.Nullable

Description

SDP.Nullable provides Nullable - class of types with empty values.

Synopsis

Nullable

class Nullable e where Source #

Nullable is class of types which have empty values.

Nullable instances must follow some rules:

   isNull Z === True
   x == Z ==> isNull x == True
   x == y === isNull x == isNull y
   
   -- For Foldable instances
   toList Z === []
   fold   Z === mempty
   isNull x === null x
   isNull x === length x == 0
   
   sum      Z === 0
   product  Z === 1
   elem   x Z === False
   foldr  f Z === foldl  f Z === id
   foldr1 f Z === foldl1 f Z === undefined
 

Minimal complete definition

Nothing

Methods

lzero :: e Source #

Empty value.

default lzero :: Monoid e => e Source #

isNull :: e -> Bool Source #

Is value empty?

default isNull :: Eq e => e -> Bool Source #

Instances

Instances details
Nullable E Source #

Since: 0.2.1

Instance details

Defined in SDP.Finite

Methods

lzero :: E Source #

isNull :: E -> Bool Source #

Nullable [e] Source # 
Instance details

Defined in SDP.Nullable

Methods

lzero :: [e] Source #

isNull :: [e] -> Bool Source #

Nullable (Maybe e) Source # 
Instance details

Defined in SDP.Nullable

Methods

lzero :: Maybe e Source #

isNull :: Maybe e -> Bool Source #

Nullable (StablePtr e) Source # 
Instance details

Defined in SDP.Nullable

Nullable (Ptr e) Source # 
Instance details

Defined in SDP.Nullable

Methods

lzero :: Ptr e Source #

isNull :: Ptr e -> Bool Source #

Nullable (FunPtr e) Source #

Since: 0.2.1

Instance details

Defined in SDP.Nullable

Nullable (ForeignPtr e) Source # 
Instance details

Defined in SDP.Nullable

Nullable (SBytes# e) Source # 
Instance details

Defined in SDP.Prim.SBytes

Nullable (SArray# e) Source # 
Instance details

Defined in SDP.Prim.SArray

Nullable (TArray# e) Source # 
Instance details

Defined in SDP.Prim.TArray

Index i => Nullable (i, i) Source # 
Instance details

Defined in SDP.Index

Methods

lzero :: (i, i) Source #

isNull :: (i, i) -> Bool Source #

Nullable (AnyChunks rep e) Source # 
Instance details

Defined in SDP.Templates.AnyChunks

Methods

lzero :: AnyChunks rep e Source #

isNull :: AnyChunks rep e -> Bool Source #

(Index i, Bordered (rep e) Int, Nullable (rep e)) => Nullable (AnyBorder rep i e) Source # 
Instance details

Defined in SDP.Templates.AnyBorder

Methods

lzero :: AnyBorder rep i e Source #

isNull :: AnyBorder rep i e -> Bool Source #

type Nullable1 rep e = Nullable (rep e) Source #

Nullable contraint for (Type -> Type)-kind types.

Since: 0.2.1

type Nullable2 rep i e = Nullable (rep i e) Source #

Nullable contraint for (Type -> Type -> Type)-kind types.

Since: 0.2.1

Rank 2 quantified constraints

GHC 8.6.1+ only

type Nullable' rep = forall e. Nullable (rep e) Source #

Nullable contraint for (Type -> Type)-kind types.

Since: 0.2.1

type Nullable'' rep = forall i e. Nullable (rep i e) Source #

Nullable contraint for (Type -> Type -> Type)-kind types.

Since: 0.2.1

Patterns

pattern NULL :: Nullable e => e Source #

Originally defined in sdp-ctypes (now sdp-foreign), same as Z now.

pattern Z :: Nullable e => e Source #

Other empty value pattern: Z === NULL.

Defined in SDP.Nullable since sdp-0.2.1, earlier - in SDP.Linear.