Copyright | (c) Grant Weyburne 2022 |
---|---|
License | BSD-3 |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- data Pos
- pattern Pos :: Int -> Pos
- unP :: Pos -> Int
- _P :: forall n. PosC n => Pos
- unsafePos :: HasCallStack => String -> Int -> Pos
- eitherPos :: Int -> Either String Pos
- _1P :: Pos
- _2P :: Pos
- _3P :: Pos
- _4P :: Pos
- _5P :: Pos
- _6P :: Pos
- _7P :: Pos
- _8P :: Pos
- _9P :: Pos
- _10P :: Pos
- _11P :: Pos
- _12P :: Pos
- _13P :: Pos
- _14P :: Pos
- _15P :: Pos
- _16P :: Pos
- _17P :: Pos
- _18P :: Pos
- _19P :: Pos
- _20P :: Pos
- (*!) :: Pos -> Pos -> Pos
- (+!) :: Pos -> Pos -> Pos
- minusP :: Pos -> Pos -> Either String Pos
- productP :: Foldable t => t Pos -> Pos
- productPInt :: Foldable t => t Pos -> Int
- safeDivP :: Pos -> Pos -> Pos
- divModP :: Int -> Pos -> (Int, Natural)
- divModNextP :: Int -> Pos -> (Int, Pos)
- maxP :: Pos -> Int -> Pos
- predP :: Pos -> Either String Pos
- succP :: Pos -> Pos
- class KnownNat n => PosC n where
- class NS ns where
- fromPositives :: Foldable t => t Pos -> [Int]
- toPositives :: Foldable t => t Int -> Either String (NonEmpty Pos)
- posRange :: Int -> Int -> Either String (NonEmpty Pos)
- pPositives :: Char -> Char -> ReadP (NonEmpty Pos)
- pPos :: ReadP Pos
- pPosInt :: ReadP Pos
- pInt :: ReadP Int
core type
holds a positive number
destructors
constructors
values
arithmetic
safeDivP :: Pos -> Pos -> Pos Source #
safely divide Pos
values but the result is increased by one to guarantee the result is still positive
next value for Pos
(not redundant as it is always successful and never partial)
type level
conversion from list of Nats to Positives
miscellaneous
fromPositives :: Foldable t => t Pos -> [Int] Source #
converts a container of positives to a list of ints
toPositives :: Foldable t => t Int -> Either String (NonEmpty Pos) Source #
converts a list of ints to a nonempty list of positives
posRange :: Int -> Int -> Either String (NonEmpty Pos) Source #
enumerate a nonempty list of Pos
from "i" to "j"