Skip to content

Commit

Permalink
Allow @ in constructor declarations (#127)
Browse files Browse the repository at this point in the history
Reformats the standard library for
* anoma/juvix#3099
  • Loading branch information
lukaszcz authored Oct 22, 2024
1 parent ff35179 commit 481579d
Show file tree
Hide file tree
Showing 23 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Stdlib/Cairo/Ec.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ end;

builtin ec_point
type Point :=
mkPoint {
mkPoint@{
x : Field;
y : Field
};
Expand Down
2 changes: 1 addition & 1 deletion Stdlib/Cairo/Poseidon.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Stdlib.Data.List open;

builtin poseidon_state
type PoseidonState :=
mkPoseidonState {
mkPoseidonState@{
s0 : Field;
s1 : Field;
s2 : Field
Expand Down
2 changes: 1 addition & 1 deletion Stdlib/Data/BinaryTree.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Stdlib.Data.List open;

type BinaryTree (A : Type) :=
| leaf
| node {
| node@{
left : BinaryTree A;
element : A;
right : BinaryTree A
Expand Down
2 changes: 1 addition & 1 deletion Stdlib/Data/Map.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ open AVL using {AVLTree};
import Stdlib.Data.BinaryTree as Tree;

type Binding Key Value :=
mkBinding {
mkBinding@{
key : Key;
value : Value
};
Expand Down
2 changes: 1 addition & 1 deletion Stdlib/Data/Queue/Base.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Stdlib.Trait.Foldable open;

--- A first-in-first-out data structure
type Queue (A : Type) :=
mkQueue {
mkQueue@{
front : List A;
back : List A
};
Expand Down
4 changes: 2 additions & 2 deletions Stdlib/Data/Range.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import Stdlib.Data.Nat open;

--- An inclusive range of naturals
type Range N :=
mkRange {
mkRange@{
low : N;
high : N
};

type StepRange N :=
mkStepRange {
mkStepRange@{
range : Range N;
step : N
};
Expand Down
2 changes: 1 addition & 1 deletion Stdlib/Data/Set/AVL.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type AVLTree (A : Type) :=
| --- An empty AVL tree.
empty
| --- A node of an AVL tree.
node {
node@{
element : A;
height : Nat;
left : AVLTree A;
Expand Down
2 changes: 1 addition & 1 deletion Stdlib/Data/Tree.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Forest (A : Type) : Type := List (Tree A);

--- N-Ary tree.
type Tree (A : Type) :=
node {
node@{
element : A;
children : List (Tree A)
};
Expand Down
2 changes: 1 addition & 1 deletion Stdlib/Data/UnbalancedSet.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Stdlib.Data.BinaryTree as Tree;
open Tree using {BinaryTree; leaf; node};

type UnbalancedSet (A : Type) :=
mkUnbalancedSet {
mkUnbalancedSet@{
order : Ord A;
tree : BinaryTree A
};
Expand Down
2 changes: 1 addition & 1 deletion Stdlib/Trait/Applicative.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Stdlib.Data.Unit.Base open;

trait
type Applicative (F : Type -> Type) :=
mkApplicative {
mkApplicative@{
{{functor}} : Functor F;
pure : {A : Type} -> A -> F A;
ap : {A B : Type} -> F (A -> B) -> F A -> F B
Expand Down
2 changes: 1 addition & 1 deletion Stdlib/Trait/DivMod.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Stdlib.Trait.DivMod;

trait
type DivMod A :=
mkDivMod {
mkDivMod@{
{-# isabelle-operator: {name: "div", prec: 70, assoc: left} #-}
div : A -> A -> A;
{-# isabelle-operator: {name: "mod", prec: 70, assoc: left} #-}
Expand Down
2 changes: 1 addition & 1 deletion Stdlib/Trait/Eq.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Stdlib.Data.Fixity open;

--- A trait defining equality
trait
type Eq A := mkEq {eq : A -> A -> Bool};
type Eq A := mkEq@{eq : A -> A -> Bool};

syntax operator == comparison;
syntax operator /= comparison;
Expand Down
2 changes: 1 addition & 1 deletion Stdlib/Trait/Foldable/Monomorphic.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Stdlib.Trait.Foldable.Polymorphic as Poly;
{-# specialize: true #-}
trait
type Foldable (Container Elem : Type) :=
mkFoldable {
mkFoldable@{
syntax iterator for {init := 1; range := 1};
for : {B : Type} -> (B -> Elem -> B) -> B -> Container -> B;

Expand Down
2 changes: 1 addition & 1 deletion Stdlib/Trait/Foldable/Polymorphic.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Stdlib.Function open;
--- A trait for combining elements into a single result, processing one element at a time.
trait
type Foldable (F : Type -> Type) :=
mkFoldable {
mkFoldable@{
syntax iterator for {init := 1; range := 1};
for : {A B : Type} -> (B -> A -> B) -> B -> F A -> B;

Expand Down
2 changes: 1 addition & 1 deletion Stdlib/Trait/Functor/Monomorphic.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Stdlib.Trait.Functor.Polymorphic as Poly;
{-# specialize: true #-}
trait
type Functor (Container Elem : Type) :=
mkFunctor {
mkFunctor@{
syntax iterator map {init := 0; range := 1};
{-# specialize: [1] #-}
map : (Elem -> Elem) -> Container -> Container
Expand Down
2 changes: 1 addition & 1 deletion Stdlib/Trait/Functor/Polymorphic.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Stdlib.Data.Unit open;
{-# specialize: true #-}
trait
type Functor (F : Type -> Type) :=
mkFunctor {
mkFunctor@{
syntax iterator map {init := 0; range := 1};
{-# specialize: [1] #-}
map : {A B : Type} -> (A -> B) -> F A -> F B
Expand Down
2 changes: 1 addition & 1 deletion Stdlib/Trait/Integral.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Stdlib.Trait.Natural open;

trait
type Integral A :=
mkIntegral {
mkIntegral@{
naturalI : Natural A;
syntax operator - additive;
{-# isabelle-operator: {name: "-", prec: 65, assoc: left} #-}
Expand Down
2 changes: 1 addition & 1 deletion Stdlib/Trait/Monad.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Stdlib.Trait.Applicative open;

trait
type Monad (M : Type -> Type) :=
mkMonad {
mkMonad@{
{{applicative}} : Applicative M;
builtin monad-bind
bind : {A B : Type} -> M A -> (A -> M B) -> M B
Expand Down
2 changes: 1 addition & 1 deletion Stdlib/Trait/Numeric.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Stdlib.Trait.Integral open;

trait
type Numeric A :=
mkNumeric {
mkNumeric@{
integralI : Integral A;
syntax operator / multiplicative;
/ : A -> A -> A
Expand Down
2 changes: 1 addition & 1 deletion Stdlib/Trait/Ord.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ orderingEqI : Eq Ordering :=

--- A trait for defining a total order
trait
type Ord A := mkOrd {cmp : A -> A -> Ordering};
type Ord A := mkOrd@{cmp : A -> A -> Ordering};

syntax operator <= comparison;

Expand Down
2 changes: 1 addition & 1 deletion Stdlib/Trait/Partial.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Stdlib.Data.String.Base open;
import Stdlib.Debug.Fail as Debug;

trait
type Partial := mkPartial {fail : {A : Type} -> String -> A};
type Partial := mkPartial@{fail : {A : Type} -> String -> A};

open Partial public;

Expand Down
2 changes: 1 addition & 1 deletion Stdlib/Trait/Show.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ module Stdlib.Trait.Show;
import Stdlib.Data.String.Base open;

trait
type Show A := mkShow {show : A -> String};
type Show A := mkShow@{show : A -> String};
4 changes: 2 additions & 2 deletions test/Test/AVL.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Stdlib.Prelude open;

import Stdlib.Data.Set.AVL as AVL open;

type Box := mkBox {b : Nat};
type Box := mkBox@{b : Nat};

instance
BoxOrdI : Ord Box := mkOrd (Ord.cmp on Box.b);
Expand All @@ -24,7 +24,7 @@ mkTests {A} (descr : TestDescr A) : List Test :=
];

type TestDescr (A : Type) :=
mkTestDescr {
mkTestDescr@{
testTitle : String;
testLen : Nat;
testSet : AVLTree A
Expand Down

0 comments on commit 481579d

Please sign in to comment.