Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Loc.Pos
Contents
Documentation
Pos
stands for positive integer. You can also think of it as position,
because we use it to represent line and column numbers (Line
and Column
).
Pos
has instances of several of the standard numeric typeclasses, although
many of the operations throw Underflow
when non-positive values result.
Pos
does not have an Integral
instance, because there is no sensible
way to implement quotRem
.
Instances
Enum Pos Source # |
|
Eq Pos Source # | |
Num Pos Source # |
|
Ord Pos Source # | |
Read Pos Source # | |
Real Pos Source # | |
Show Pos Source # | |
ToNat Pos Source # | |
Types that can be converted to Natural
.
This class mostly exists so that toNat
can be used in situations that would
normally call for toInteger
(which we cannot use because Pos
does not have
an instance of Integral
).
Minimal complete definition
Show and Read
posShowsPrec :: Int -> Pos -> ShowS Source #
>>>
posShowsPrec minPrec 1 ""
"1"
>>>
posShowsPrec minPrec 42 ""
"42"
posReadPrec :: ReadPrec Pos Source #
>>>
readPrec_to_S posReadPrec minPrec "1"
[(1,"")]
>>>
readPrec_to_S posReadPrec minPrec "42"
[(42,"")]
>>>
readPrec_to_S posReadPrec minPrec "0"
[]
>>>
readPrec_to_S posReadPrec minPrec "-1"
[]