Skip to content

Commit

Permalink
update style wip
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcz committed Oct 8, 2024
1 parent 2c04681 commit 2c6b494
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
11 changes: 11 additions & 0 deletions CODING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ type Transferability := Transferable | NonTransferable;
- record constructors: `mk` + type name (`mkResource`)
- meaningful descriptive long names for arguments of public functions, e.g., `element`, `list`, `initialValue`
- exception: common abbreviations allowed: `fun`, `acc`
- exception: generic functions whose arguments have no specific meaning, e.g.,

```
id {A} (x : A) := x
```

- short names like `x` are okay for local definitions

## Function signatures
Expand All @@ -41,6 +47,7 @@ isMember {A} (testEq : A -> A -> Bool) (element : A) : (list : List A) -> Bool
## Type variables

- type variables uppercase (upper camel case, like with types)
- higher-order type variables also upper camel case (`F : Type -> Type`)
- implicit type variables: use short version `{A}` in function signatures on the left
- prefer `{A B}` over `{A} {B}` in function signatures
- meaningful type variable names for more "high-level" functions where this makes sense
Expand Down Expand Up @@ -81,6 +88,10 @@ find {A} (predicate : A -> Bool) : (list : List A) -> Maybe A
- use iterators `for` , `map`, etc., instead of the function application syntax with `fold`, etc.
- use named application when reasonable

## Type definitions

- give meaningful names to constructor arguments

## Documentation

- the documentation string should be an English sentence
Expand Down
6 changes: 2 additions & 4 deletions src/Juvix/Compiler/Concrete/Data/NameSpace.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,5 @@ resolveNameSpaceEntry = case sing :: SNameSpace ns of
resolveFixitySymbolEntry (FixitySymbolEntry n1) (FixitySymbolEntry n2) = FixitySymbolEntry (resolveName n1 n2)

resolveName :: S.Name -> S.Name -> S.Name
resolveName n1 n2
| n1 ^. S.nameId == n2 ^. S.nameId =
over S.nameVisibilityAnn (resolveVisibility (n2 ^. S.nameVisibilityAnn)) n1
| otherwise = impossible
resolveName n1 n2 =
over S.nameVisibilityAnn (resolveVisibility (n2 ^. S.nameVisibilityAnn)) n1

0 comments on commit 2c6b494

Please sign in to comment.