Skip to content

Commit cadc930

Browse files
authored
Merge pull request #158 from mlabs-haskell/bladyjoker/update-haskell
Updating GHC, Hackage, CTL etc.
2 parents 617ac92 + f61e0ee commit cadc930

File tree

65 files changed

+7782
-13188
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+7782
-13188
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ competitors if your project requires:
2020
1. _Parameterized Data Types_ (aka. type functions): Unlike ProtoBuffers or
2121
JSON Schema, LambdaBuffers allows users to define algebraic data types which
2222
take type variable arguments. If your project's domain is most accurately
23-
represented by parameterized data types, LamdaBuffers may be a good choice
23+
represented by parameterized data types, LambdaBuffers may be a good choice
2424
for your needs.
2525

2626
2. _Opaque Types_: Almost every competing schema language provides users a
@@ -41,7 +41,7 @@ competitors if your project requires:
4141
productively make use of the generated types. While LambdaBuffers is still a
4242
work-in-progress, we expect that, upon completion, an extensive test suite
4343
will provide a high degree of assurance that the instances/methods generated
44-
by the LamdaBuffers code generator behave identically.
44+
by the LambdaBuffers code generator behave identically.
4545

4646
## Documentation
4747

api/build.nix

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,41 @@
11
{ inputs, ... }:
22
{
3-
perSystem = { pkgs, system, config, ... }:
3+
perSystem = { pkgs, system, config, inputs', ... }:
44
let
5-
pbnix-lib = inputs.protobufs-nix.lib.${system};
5+
proto-nix = inputs.proto-nix.lib.${system};
66
in
77
rec {
88

99
devShells.dev-api = pkgs.mkShell {
1010
name = "protos-env";
11-
buildInputs = [
12-
pkgs.protobuf
13-
pkgs.haskellPackages.proto-lens-protoc
14-
pkgs.protoc-gen-doc
15-
] ++ config.settings.shell.tools;
16-
11+
inputsFrom = [ inputs'.proto-nix.devShells.dev-proto-nix ];
1712
shellHook = config.settings.shell.hook;
1813
};
1914

2015
packages = {
21-
lambda-buffers-lang-hs-pb = pbnix-lib.haskellProto {
22-
inherit pkgs;
16+
lambda-buffers-lang-hs-pb = proto-nix.haskellProto {
2317
src = ./.;
24-
proto = "lang.proto";
18+
protos = [ "lang.proto" ];
2519
cabalPackageName = "lambda-buffers-lang-pb";
2620
};
2721

28-
lambda-buffers-compiler-hs-pb = pbnix-lib.haskellProto {
29-
inherit pkgs;
22+
lambda-buffers-compiler-hs-pb = proto-nix.haskellProto {
3023
src = ./.;
31-
proto = "compiler.proto";
24+
protos = [ "compiler.proto" ];
3225
cabalBuildDepends = [ packages.lambda-buffers-lang-hs-pb ];
3326
cabalPackageName = "lambda-buffers-compiler-pb";
3427
};
3528

36-
lambda-buffers-codegen-hs-pb = pbnix-lib.haskellProto {
37-
inherit pkgs;
29+
lambda-buffers-codegen-hs-pb = proto-nix.haskellProto {
3830
src = ./.;
39-
proto = "codegen.proto";
31+
protos = [ "codegen.proto" ];
4032
cabalBuildDepends = [ packages.lambda-buffers-lang-hs-pb ];
4133
cabalPackageName = "lambda-buffers-codegen-pb";
4234
};
4335

44-
lambda-buffers-api-docs = pkgs.stdenv.mkDerivation {
36+
lambda-buffers-api-docs = proto-nix.docProto {
4537
src = ./.;
46-
name = "lambdabuffers-api-docs";
47-
buildInputs = [
48-
pkgs.protobuf
49-
];
50-
buildPhase = ''
51-
mkdir $out;
52-
protoc --plugin=${pkgs.protoc-gen-doc}/bin/protoc-gen-doc lang.proto compiler.proto codegen.proto --doc_out=$out --doc_opt=markdown,api.md;
53-
'';
38+
protos = [ "lang.proto" "compiler.proto" "codegen.proto" ];
5439
};
5540
};
5641
};

api/lang.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ message SourcePosition {
2727

2828
/* Type term
2929
30-
A type term that ocurrs in bodies of type definitions (message TyDef):
30+
A type term that occurs in bodies of type definitions (message TyDef):
3131
3232
```lbf
3333
sum Maybe a = Just a | Nothing
@@ -146,7 +146,7 @@ message TyName {
146146

147147
/* Module name */
148148
message ModuleName {
149-
// Parts of the module name denoting a hierarchichal namespace.
149+
// Parts of the module name denoting a hierarchical namespace.
150150
repeated ModuleNamePart parts = 1;
151151
// Source information.
152152
SourceInfo source_info = 2;

docs/feedback/interview-notes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
1. R. would like it to be seamless. R. mentions:
4747
1. Auto generate modules
4848
2. pre-commit hooks
49-
3. itterate quickly
49+
3. iterate quickly
5050
4. Nix integration is very important
5151
5. Not running commands.
5252
6. Watch function for the compiler.

docs/haskell.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ $ ghc autogen/LambdaBuffers/Document.hs
108108

109109
## Sum types
110110

111-
The types `Author`, `Reviewer`, and `RichContent` have been declared as sum types in the LamdaBuffers schema using the `sum` keyword.
111+
The types `Author`, `Reviewer`, and `RichContent` have been declared as sum types in the LambdaBuffers schema using the `sum` keyword.
112112

113113
As we can see, nothing too surprising here, all the `sum` types become `data`
114114
in Haskell.
@@ -119,7 +119,7 @@ quote) to the defined constructor names as to make sure they are unique.
119119
## Product types
120120

121121
The type `RichDocument` have been declared as a product type in the
122-
LamdaBuffers schema using the `prod` keyword.
122+
LambdaBuffers schema using the `prod` keyword.
123123

124124
They become Haskell `newtype` if they have a single type in their body, otherwise they are `data`.
125125

@@ -128,7 +128,7 @@ Note that the constructor has the same name as the type.
128128
## Record types
129129

130130
The types `Document` and `Chapter` have been declared as record types in the
131-
LamdaBuffers schema using the `record` keyword.
131+
LambdaBuffers schema using the `record` keyword.
132132

133133
Like with product types, they become Haskell `newtype` if they have a single
134134
type in their body, otherwise they are `data`.

docs/introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ competitors if your project requires:
1818
1. _Parameterized Data Types_ (aka. type functions): Unlike ProtoBuffers or
1919
JSON Schema, LambdaBuffers allows users to define algebraic data types which
2020
take type variable arguments. If your project's domain is most accurately
21-
represented by parameterized data types, LamdaBuffers may be a good choice
21+
represented by parameterized data types, LambdaBuffers may be a good choice
2222
for your needs.
2323

2424
2. _Opaque Types_: Almost every competing schema language provides users a
@@ -39,4 +39,4 @@ competitors if your project requires:
3939
productively make use of the generated types. While LambdaBuffers is still a
4040
work-in-progress, we expect that, upon completion, an extensive test suite
4141
will provide a high degree of assurance that the instances/methods generated
42-
by the LamdaBuffers code generator behave identically.
42+
by the LambdaBuffers code generator behave identically.

docs/plutarch/plutarch-example.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ common common-language
2020
ghc-options: -Werror
2121

2222
default-extensions:
23-
NoStarIsType
2423
BangPatterns
2524
BinaryLiterals
2625
ConstrainedClassMethods
@@ -57,6 +56,7 @@ common common-language
5756
MultiParamTypeClasses
5857
NamedFieldPuns
5958
NamedWildCards
59+
NoStarIsType
6060
NumericUnderscores
6161
OverloadedLabels
6262
OverloadedStrings

docs/purescript.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ instance Data.Show.Show RichDocument where
123123

124124
## Sum types
125125

126-
The types `Author`, `Reviewer`, and `RichContent` have been declared as sum types in the LamdaBuffers schema using the `sum` keyword.
126+
The types `Author`, `Reviewer`, and `RichContent` have been declared as sum types in the LambdaBuffers schema using the `sum` keyword.
127127

128128
As we can see, nothing too surprising here, all the `sum` types become `data`
129129
in Purescript.
@@ -134,7 +134,7 @@ quote) to the defined constructor names as to make sure they are unique.
134134
## Product types
135135

136136
The type `RichDocument` have been declared as a product type in the
137-
LamdaBuffers schema using the `prod` keyword.
137+
LambdaBuffers schema using the `prod` keyword.
138138

139139
They become Purescript `newtype` if they have a single type in their body, otherwise they are `data`.
140140

@@ -143,7 +143,7 @@ Note that the constructor has the same name as the type.
143143
## Record types
144144

145145
The types `Document` and `Chapter` have been declared as record types in the
146-
LamdaBuffers schema using the `record` keyword.
146+
LambdaBuffers schema using the `record` keyword.
147147

148148
They always become Purescript `newtype`, and wrapped within is a Purescript
149149
record type with the fields named exactly like they are named in the

experimental/build.nix

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
_: {
2-
perSystem = { pkgs, config, ... }:
2+
perSystem = { pkgs, config, inputs', ... }:
33
{
44

55
devShells.dev-experimental = pkgs.mkShell {
66
name = "experimental-env";
77
buildInputs = [
88
pkgs.dhall
9-
pkgs.dhall-lsp-server
9+
# TODO(bladyjoker): error: Package ‘dhall-lsp-server-1.1.3’ in /nix/store/p7iz0r8gs6ppkhj83zjmwyd21k8b7v3y-source/pkgs/development/haskell-modules/hackage-packages.nix:84957 is marked as broken, refusing to evaluate.
10+
# pkgs.dhall-lsp-server
1011
pkgs.dhall-json
1112

12-
(pkgs.haskellPackages.ghcWithPackages (pkgs: [
13-
pkgs.text
14-
pkgs.unification-fd
15-
pkgs.HUnit
13+
(pkgs.haskellPackages.ghcWithPackages (hsPkgs: [
14+
hsPkgs.text
15+
hsPkgs.unification-fd
16+
hsPkgs.HUnit
1617
]))
17-
pkgs.haskell-language-server
1818

1919
pkgs.protobuf
20-
pkgs.haskellPackages.proto-lens-protoc
20+
pkgs.haskellPackages.haskell-language-server
2121
pkgs.swiPrologWithGui
2222
] ++ config.settings.shell.tools;
2323

2424
shellHook = config.settings.shell.hook;
25+
inputsFrom = [ inputs'.proto-nix.devShells.dev-proto-nix ];
2526
};
2627

2728
};

extras/build.nix

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
# Makes a per system `lbf-nix` option.
2323
perSystem = flake-parts-lib.mkPerSystemOption
24-
({ pkgs, config, ... }: {
24+
({ pkgs, system, config, ... }: {
2525

2626
options.lbf-nix = lib.mkOption {
2727
type = lib.types.anything;
@@ -32,7 +32,22 @@
3232
config = {
3333
lbf-nix = {
3434
# NOTE(bladyjoker): If you need to add a function the export externally and use internally via config.lbf-nix, add it here.
35-
purescriptFlake = import ./flake-purescript.nix pkgs;
35+
36+
purescriptFlake =
37+
let
38+
pkgs' = import inputs.ctl-nixpkgs {
39+
inherit system;
40+
inherit (inputs.haskell-nix) config;
41+
overlays = [
42+
inputs.haskell-nix.overlay
43+
inputs.iohk-nix.overlays.crypto
44+
inputs.ctl.overlays.purescript
45+
inputs.ctl.overlays.spago
46+
];
47+
};
48+
in
49+
import ./flake-purescript.nix pkgs'; # TODO(bladyjoker): If we use recent nixpkgs we get: `error: nodejs_14 has been removed as it is EOL`. That's why we use CTL's old nixpkgs.
50+
3651
rustFlake = import ./flake-rust.nix pkgs;
3752
haskellData = import ./haskell-data.nix pkgs;
3853
haskellFlake = import ./flake-haskell.nix pkgs;

0 commit comments

Comments
 (0)