quantizer-0.2.1.0: Library to provide the behaviour similar to quantum states superposition.
Copyright(c) OleksandrZhabenko 2022-2023
LicenseMIT
Maintaineroleksandr.zhabenko@yahoo.com
StabilityExperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

FoldableQuantizer

Description

A module to provide the extended variants to convert a InsertLeft instance structure with some values to another one with the values from the pre-defined structure. Similar to the measurement of the quantum state observables with the discrete spectrum. For performance reasons it is better to use module ListQuantizer whenever possible (especially if the given Foldable and InsertLeft instances are just lists).

Documentation

round2G Source #

Arguments

:: (Ord a, InsertLeft t a, Monoid (t a)) 
=> Bool

If True then the function rounds the result in the ambiguous situation to the greater value.

-> (t a -> a -> Ordering) 
-> t a 
-> a 
-> Maybe a

The a value (in Just case) can be equal just to the one of the two first a arguments.

foldableQuantizerG Source #

Arguments

:: (Ord a, Floating a, Integral a, InsertLeft t1 a, Monoid (t1 a), Foldable t2) 
=> Bool

If True then the function rounds the result in the ambiguous situation to the greater value.

-> (t1 a -> a -> Ordering) 
-> t1 a 
-> t2 a 
-> [a] 

round2GM Source #

Arguments

:: (Ord a, Monad m, InsertLeft t1 a, Monoid (t1 a)) 
=> Bool

If True then the function rounds the result in the ambiguous situation to the greater value.

-> (t1 a -> a -> m Ordering) 
-> t1 a 
-> a 
-> m (Maybe a) 

foldableQuantizerGM Source #

Arguments

:: (Ord a, Floating a, Integral a, Monad m, InsertLeft t1 a, Monoid (t1 a), Foldable t2) 
=> Bool

If True then the function rounds the result in the ambiguous situation to the greater value.

-> (t1 a -> a -> m Ordering) 
-> t1 a 
-> t2 a 
-> m [a]