primus-0.3.0.0: nonempty and positive functions
Copyright(c) Grant Weyburne 2022
LicenseBSD-3
Safe HaskellNone
LanguageHaskell2010

Primus.Num1

Description

 
Synopsis

Documentation

class Num1 a where Source #

lifted version of Num class for handling failure minimal definition requires toInteger1 and fromInteger1 unless leveraging default signatures

Minimal complete definition

Nothing

Methods

toInteger1 :: a -> Integer Source #

required method for converting from "a" to an Integer

default toInteger1 :: Enum a => a -> Integer Source #

fromInteger1 :: a -> Integer -> Either String a Source #

required method for trying to convert from an Integer to "a"

default fromInteger1 :: (Bounded a, Enum a) => a -> Integer -> Either String a Source #

(.+) :: Either String a -> Either String a -> Either String a infixl 6 Source #

(.-) :: Either String a -> Either String a -> Either String a infixl 6 Source #

(.*) :: Either String a -> Either String a -> Either String a infixl 7 Source #

negate1 :: Either String a -> Either String a Source #

abs1 :: Either String a -> Either String a Source #

signum1 :: Either String a -> Either String a Source #

succ1 :: Either String a -> Either String a Source #

pred1 :: Either String a -> Either String a Source #

Instances

Instances details
Num1 Int Source # 
Instance details

Defined in Primus.Num1

Num1 Int8 Source # 
Instance details

Defined in Primus.Num1

Num1 Int16 Source # 
Instance details

Defined in Primus.Num1

Num1 Int32 Source # 
Instance details

Defined in Primus.Num1

Num1 Int64 Source # 
Instance details

Defined in Primus.Num1

Num1 Natural Source # 
Instance details

Defined in Primus.Num1

Num1 Word Source # 
Instance details

Defined in Primus.Num1

Num1 Word8 Source # 
Instance details

Defined in Primus.Num1

Num1 Word16 Source # 
Instance details

Defined in Primus.Num1

Num1 Word32 Source # 
Instance details

Defined in Primus.Num1

Num1 Word64 Source # 
Instance details

Defined in Primus.Num1

Num1 Pos Source # 
Instance details

Defined in Primus.Num1

withOp :: Num1 a => (Integer -> Integer) -> a -> Either String a Source #

run a function of one integer against the underlying Num1 type

withOp2 :: Num1 a => (Integer -> Integer -> Integer) -> a -> a -> Either String a Source #

run a function of two integers against the underlying Num1 types

withOp3 :: Num1 a => (Integer -> Integer -> Integer -> Integer) -> a -> a -> a -> Either String a Source #

run a function of three integers against the underlying Num1 types

withOp4 :: Num1 a => (Integer -> Integer -> Integer -> Integer -> Integer) -> a -> a -> a -> a -> Either String a Source #

run a function of four integers against the underlying Num1 types