Skip to content

Commit

Permalink
Alter ModuloSemiring case
Browse files Browse the repository at this point in the history
  • Loading branch information
garyb committed Feb 16, 2015
1 parent 21eea0d commit 87ff526
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions prelude/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
Ring where every nonzero element has a multiplicative inverse (possibly
a non-commutative field) so that ```a `mod` b = zero```

class (Ring a, ModuloSemiRing a) <= DivisionRing a where
class (Ring a, ModuloSemiring a) <= DivisionRing a where

#### `Eq`

Expand All @@ -77,12 +77,12 @@ a non-commutative field) so that ```a `mod` b = zero```
class Functor f where
(<$>) :: forall a b. (a -> b) -> f a -> f b

#### `ModuloSemiRing`
#### `ModuloSemiring`

Semiring with modulo operation and division where
```a / b * b + (a `mod` b) = a```

class (Semiring a) <= ModuloSemiRing a where
class (Semiring a) <= ModuloSemiring a where
(/) :: a -> a -> a
mod :: a -> a -> a

Expand Down Expand Up @@ -192,9 +192,9 @@ Addition and multiplication

instance functorArr :: Functor (Prim.Function r)

#### `moduloSemiRingNumber`
#### `moduloSemiringNumber`

instance moduloSemiRingNumber :: ModuloSemiRing Number
instance moduloSemiringNumber :: ModuloSemiring Number

#### `monadArr`

Expand Down
Binary file modified prelude/images/Prelude.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions prelude/prelude.purs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module Prelude
, Bind, (>>=)
, Monad, return, liftM1, ap
, Semiring, (+), zero, (*), one
, ModuloSemiRing, (/), mod
, ModuloSemiring, (/), mod
, Ring, (-)
, (%)
, negate
Expand Down Expand Up @@ -219,7 +219,7 @@ module Prelude

-- | Semiring with modulo operation and division where
-- | ```a / b * b + (a `mod` b) = a```
class (Semiring a) <= ModuloSemiRing a where
class (Semiring a) <= ModuloSemiring a where
(/) :: a -> a -> a
mod :: a -> a -> a

Expand All @@ -232,7 +232,7 @@ module Prelude

-- | Ring where every nonzero element has a multiplicative inverse (possibly
-- | a non-commutative field) so that ```a `mod` b = zero```
class (Ring a, ModuloSemiRing a) <= DivisionRing a
class (Ring a, ModuloSemiring a) <= DivisionRing a

-- | A commutative field
class (DivisionRing a) <= Num a
Expand Down Expand Up @@ -293,7 +293,7 @@ module Prelude
instance ringNumber :: Ring Number where
(-) = numSub

instance moduloSemiRingNumber :: ModuloSemiRing Number where
instance moduloSemiringNumber :: ModuloSemiring Number where
(/) = numDiv
mod _ _ = 0

Expand Down
2 changes: 1 addition & 1 deletion src/Language/PureScript/CodeGen/JS/Optimizer/Inliner.hs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ inlineCommonOperators = applyAll $
, binary C.semiringNumber (C.*) Multiply
, binary C.ringNumber (C.-) Subtract
, unary C.ringNumber C.negate Negate
, binary C.moduloSemiRingNumber (C./) Divide
, binary C.moduloSemiringNumber (C./) Divide

, binary C.ordNumber (C.<) LessThan
, binary C.ordNumber (C.>) GreaterThan
Expand Down
4 changes: 2 additions & 2 deletions src/Language/PureScript/Constants.hs
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ semiringNumber = "semiringNumber"
ringNumber :: String
ringNumber = "ringNumber"

moduloSemiRingNumber :: String
moduloSemiRingNumber = "moduloSemiRingNumber"
moduloSemiringNumber :: String
moduloSemiringNumber = "moduloSemiringNumber"

numNumber :: String
numNumber = "numNumber"
Expand Down

0 comments on commit 87ff526

Please sign in to comment.