Skip to content

Commit

Permalink
Minor touch-ups.
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornbm committed Jan 25, 2012
1 parent 4edc01d commit 98c40a7
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions Numeric/NumType/TF.lhs
Expand Up @@ -54,13 +54,12 @@ This module requires GHC 7.0 or later.
> >
> -} > -}


> module Numeric.NumType.TF > module Numeric.NumType.TF (
> -- Basic classes (exported versions).
> (
> -- * Type level integers > -- * Type level integers
> NumType > NumType
> -- Data types (exported to avoid lengthy qualified types in complier > -- * Data types
> -- error messages). > -- | These are exported to avoid lengthy qualified types in complier
> -- error messages.
> , Z, S, N > , Z, S, N
> -- * Type level arithmetics > -- * Type level arithmetics
> , Pred, Succ, Negate, Add, Sub, Div, Mul > , Pred, Succ, Negate, Add, Sub, Div, Mul
Expand Down Expand Up @@ -90,14 +89,14 @@ class function 'toNum' that converts from the type-level to a
value-level 'Num'. value-level 'Num'.


> class NumTypeI n where > class NumTypeI n where
> -- | Convert a type level integer to an instance of 'Prelude.Num'.
> toNum :: Num a => n -> a
> -- | Negation. > -- | Negation.
> type Negate n > type Negate n
> -- | Predecessor. > -- | Predecessor.
> type Pred n > type Pred n
> -- | Successor. > -- | Successor.
> type Succ n > type Succ n
> -- | Convert a type level integer to an instance of 'Prelude.Num'.
> toNum :: Num a => n -> a




Now we use a trick from Oleg Kiselyov and Chung-chieh Shan [2]: Now we use a trick from Oleg Kiselyov and Chung-chieh Shan [2]:
Expand Down Expand Up @@ -267,7 +266,7 @@ top of 'DivP'. A trivial but tedious exercise.
= Value level functions = = Value level functions =


> {- $functions > {- $functions
> Using the above type classes we define functions for various > Using the above type families we define functions for various
> arithmetic operations. All functions are undefined and only operate > arithmetic operations. All functions are undefined and only operate
> on the type level. Their main contribution is that they facilitate > on the type level. Their main contribution is that they facilitate
> NumType arithmetic without explicit (and tedious) type declarations. > NumType arithmetic without explicit (and tedious) type declarations.
Expand Down

0 comments on commit 98c40a7

Please sign in to comment.