-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use instance fields to make Natural into a FromNatural
- Loading branch information
1 parent
dad5c1a
commit 57964c6
Showing
2 changed files
with
9 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
module Juvix.Builtin.V1.Nat; | ||
|
||
import Juvix.Builtin.V1.Trait.Natural open public; | ||
import Juvix.Builtin.V1.Trait.FromNatural open public; | ||
import Juvix.Builtin.V1.Nat.Base open hiding {+; *; div; mod} public; | ||
import Juvix.Builtin.V1.Nat.Base as Nat; | ||
|
||
{-# specialize: true, inline: case #-} | ||
instance | ||
fromNaturalNatI : FromNatural Nat := | ||
mkFromNatural@{ | ||
fromNat (x : Nat) : Nat := x | ||
}; | ||
|
||
{-# specialize: true, inline: case #-} | ||
instance | ||
naturalNatI : Natural Nat := | ||
mkNatural@{ | ||
+ := (Nat.+); | ||
* := (Nat.*); | ||
fromNat (x : Nat) : Nat := x | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters