sdp-0.2.0.1: Simple Data Processing
Copyright(c) Andrey Mulik 2019
LicenseBSD-style
Maintainerwork.a.mulik@gmail.com
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe
LanguageHaskell2010

SDP.SortM

Contents

Description

SDP.SortM provides SortM - class of sortable mutable structures.

Synopsis

SortM

class SortM m s e | s -> m, s -> e where Source #

SortM is class of sortable mutable structures.

Methods

sortedMBy :: (e -> e -> Bool) -> s -> m Bool Source #

Checks if structure is already sorted. Should always return True for structures with less than 2 elements.

sortMBy :: Compare e -> s -> m () Source #

sortMBy is common sorting algorithm.

Instances

Instances details
(MonadIO io, Unboxed e) => SortM io (MIOBytes# io e) e Source # 
Instance details

Defined in SDP.Prim.SBytes

Methods

sortedMBy :: (e -> e -> Bool) -> MIOBytes# io e -> io Bool Source #

sortMBy :: Compare e -> MIOBytes# io e -> io () Source #

MonadIO io => SortM io (MIOArray# io e) e Source # 
Instance details

Defined in SDP.Prim.SArray

Methods

sortedMBy :: (e -> e -> Bool) -> MIOArray# io e -> io Bool Source #

sortMBy :: Compare e -> MIOArray# io e -> io () Source #

(BorderedM1 m rep Int e, SortM1 m rep e, SplitM1 m rep e, LinearM1 m rep e) => SortM m (AnyChunks rep e) e Source # 
Instance details

Defined in SDP.Templates.AnyChunks

Methods

sortedMBy :: (e -> e -> Bool) -> AnyChunks rep e -> m Bool Source #

sortMBy :: Compare e -> AnyChunks rep e -> m () Source #

(Index i, SortM1 m rep e) => SortM m (AnyBorder rep i e) e Source # 
Instance details

Defined in SDP.Templates.AnyBorder

Methods

sortedMBy :: (e -> e -> Bool) -> AnyBorder rep i e -> m Bool Source #

sortMBy :: Compare e -> AnyBorder rep i e -> m () Source #

Unboxed e => SortM (ST s) (STBytes# s e) e Source # 
Instance details

Defined in SDP.Prim.SBytes

Methods

sortedMBy :: (e -> e -> Bool) -> STBytes# s e -> ST s Bool Source #

sortMBy :: Compare e -> STBytes# s e -> ST s () Source #

SortM (ST s) (STArray# s e) e Source # 
Instance details

Defined in SDP.Prim.SArray

Methods

sortedMBy :: (e -> e -> Bool) -> STArray# s e -> ST s Bool Source #

sortMBy :: Compare e -> STArray# s e -> ST s () Source #

type SortM1 m s e = SortM m (s e) e Source #

Kind (* -> *) version of SortM.

sortM :: (SortM m s e, Ord e) => s -> m () Source #

sortMOn :: (SortM m s e, Ord o) => (e -> o) -> s -> m () Source #

Sort by comparing the results of a key function applied to each element.

sortedM :: (SortM m s e, Ord e) => s -> m Bool Source #

Checks if the structure is sorted.

sortedMOn :: (SortM m s e, Ord o) => (e -> o) -> s -> m Bool Source #

Sort by comparing the results of a given function applied to each element.