Module

Type.Data.Peano.Int.Parse

Package
purescript-typelevel-peano
Repository
csicar/purescript-typelevel-peano

#ParseInt Source

class ParseInt (sym :: Symbol) (int :: Int) | int -> sym, sym -> int

Parse a Int from a Symbol

ParseInt "-10" N10
ParseInt "1337" P1337 -- P1137 would be type alias for Pos (Succ^1337 Z)

Instances

  • (Equals "-" head isMinus, If isMinus (proxy (Neg natValue)) (proxy (Pos natValue)) (proxy int), If isMinus (sproxy tail) (sproxy sym) (sproxy numberSymbol), Cons head tail sym, ParseNat numberSymbol natValue) => ParseInt sym int

#parseInt Source

parseInt :: forall sproxy proxy sym a. ParseInt sym a => sproxy sym -> proxy a

parse Int a Value-Level

parseInt (Proxy  :: _ "-1337") ~> N1337
parseInt (SProxy :: _ "-1337") ~> N1337
    -- N1137 would be type alias for Neg (Succ^1337 Z)