Copyright | (c) Andrey Mulik 2020-2021 |
---|---|
License | BSD-style |
Maintainer | work.a.mulik@gmail.com |
Portability | non-portable (GHC extensions) |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
SDP.Nullable provides Nullable
- class of types with empty values.
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
Nothing
Empty value.
Is value empty?
Instances
Nullable E Source # | Since: 0.2.1 |
Nullable [e] Source # | |
Nullable (Maybe e) Source # | |
Nullable (StablePtr e) Source # | |
Nullable (Ptr e) Source # | |
Nullable (FunPtr e) Source # | Since: 0.2.1 |
Nullable (ForeignPtr e) Source # | |
Defined in SDP.Nullable lzero :: ForeignPtr e Source # isNull :: ForeignPtr e -> Bool Source # | |
Nullable (SBytes# e) Source # | |
Nullable (SArray# e) Source # | |
Nullable (TArray# e) Source # | |
Index i => Nullable (i, i) Source # | |
Nullable (AnyChunks rep e) Source # | |
(Index i, Bordered (rep e) Int, Nullable (rep e)) => Nullable (AnyBorder rep i e) 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.