mmsyn2-0.3.2.0: The library that can be used for multiple (Ord a) => a -> b transformations
Copyright(c) OleksandrZhabenko 2019-2021
LicenseMIT
Maintainerolexandr543@yahoo.com
StabilityExperimental
Safe HaskellNone
LanguageHaskell2010

CaseBi.Unboxed

Description

 
Synopsis

Function that can be used instead of case ... of construction

getBFst' Source #

Arguments

:: (Ord a, Unbox a, Unbox b) 
=> (b, Vector (a, b))

b is a default value that can be substituted if there is no correspendence in the set of (a, b) tuples (the otherwise or irrefutable pattern analogue). Vector of the (a, b) tuples that must be sorted in ascending order for the first argument. If there are several pairs (a, b) with the same a, the function gives a resulting b as if there is only the first one

-> a

an element for which the corresponding resulting b must be found

-> b

the result

A variant of the getBFst' function that operates on the unboxed Vector.

getBFst Source #

Arguments

:: (Ord a, Unbox a, Unbox b) 
=> Vector (a, b)

Vector of the (a, b) tuples that must be sorted in ascending order for the first argument

-> b

a default value that can be substituted if there is no correspendence in the set of (a, b) tuples (the otherwise or irrefutable pattern analogue)

-> [a]

a list of values needed to be transformed accordingly to the correct (a, b) tuple pairs

-> [b]

the resulting list

A variant of the getBFst that operates on the unboxed Vector.

getBFstV Source #

Arguments

:: (Ord a, Unbox a, Unbox b) 
=> Vector (a, b)

Vector of the (a, b) tuples that are sorted in ascending order for the first argument

-> b

a default value that can be substituted if there is no correspendence in the set of (a, b) tuples (the otherwise or irrefutable pattern analogue)

-> Vector a

a Vector needed to be transformed accordingly to the correct (a, b) tuple pairs

-> Vector b

the resulting Vector

A variant of the getBFstV that operates on the unboxed Vector.

Additional functions that are used to sort a list of pairs (which can be obtained e. g. by zip)

sortFst :: (Ord a, Unbox a, Unbox b) => [(a, b)] -> [(a, b)] Source #

A variant of the sortFst that operates on the unboxed Vector. It is inspired by the work: https://wiki.haskell.org/Introduction

sortFstV Source #

Arguments

:: (Ord a, Unbox a, Unbox b) 
=> [(a, b)]

The list of conditions that is then converted to the corresponding Vector

-> Vector (a, b)

the resulting sorted Vector that can be used further in getBFst' and its successors.

A variant of the sortFstV that operates on the unboxed Vector.

Function that can be used for changing the Vector (a, b) during its creation

filterP Source #

Arguments

:: (Ord a, Unbox a, Unbox b) 
=> ((a, b) -> Bool)

The predicate p used to select the only one value of b in the pairs (a, b) with the same a. ^ If there are several pairs (a, b) for the same a that satisfies a predicate then the first one is used. For large [(a, b)] ^ it can be rather complex.

-> [(a, b)]

The list of (a, b) sorted in the ascending order by the first element a (e. g. by the sortFst function)

-> Vector (a, b)

The resulting filtered Vector (a, b) that can be used for getFstB' and its successor functions.

A variant of the filterP that operates on the unboxed Vector.