Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
6229475
Adds lbf libs and runtimes with a drafter lbr-json-plutus for haskell
bladyjoker Jun 5, 2023
e2498c7
Intervals done
bladyjoker Jun 5, 2023
1e1fab8
POSIXTime done
bladyjoker Jun 5, 2023
42ebbac
Address and Credential done
bladyjoker Jun 5, 2023
6853e3d
V1 done
bladyjoker Jun 5, 2023
389995d
V2 done (still missing DCERT and whole of TxInfo and ScriptContext)
bladyjoker Jun 5, 2023
34ccb99
Tests setup, Value tested
bladyjoker Jun 5, 2023
7b4c788
Merge remote-tracking branch 'origin/main' into bladyjoker/json
bladyjoker Jun 6, 2023
98bcd1b
Implements lbr-json-prelude for Haskell
bladyjoker Jun 6, 2023
4d2136a
Integrates lbr-json-prelude with lbr-json-plutus
bladyjoker Jun 6, 2023
602abeb
Saves WIP
bladyjoker Jun 10, 2023
91863bf
Implements Json parsing codegen
bladyjoker Jun 11, 2023
d3819e1
Adds derive Json statements to LB schema
bladyjoker Jun 12, 2023
8864f88
Tests the lbr-json-plutus
bladyjoker Jun 12, 2023
691037c
Now there's lbr-prelude and lbr-plutus to denote their lbf counterparts
bladyjoker Jun 12, 2023
e31310b
Full pipeline from lbf to ghci works!!!
bladyjoker Jun 12, 2023
118f5f3
lbt-prelude testsuite for Haskell WIP
bladyjoker Jun 19, 2023
911c697
Implements Json goldens for lbf-prelude
bladyjoker Jun 19, 2023
fc2c4c7
Adds goldens to Cabal data-dir
bladyjoker Jun 19, 2023
c1c04cb
Implements haskell-data.nix
bladyjoker Jun 19, 2023
593bdd7
Fixes codegen tests
bladyjoker Jun 19, 2023
40df44a
Reformulates golden architecture
bladyjoker Jun 20, 2023
5abcf98
Adds a README to lbt-prelude
bladyjoker Jun 20, 2023
7e506d6
Fixes the lbt-prelude-golden build
bladyjoker Jun 20, 2023
32304fe
Rework of lbf-haskell.nix
bladyjoker Jun 20, 2023
f4038a3
Save
bladyjoker Jun 20, 2023
08143fb
Renames to testsuites
bladyjoker Jun 21, 2023
0008dc5
Further renames
bladyjoker Jun 21, 2023
0b4622a
The testing side is set for Haskell, moving on to Purescript
bladyjoker Jun 21, 2023
93814b0
Implements lbr-prelude for Purescript
bladyjoker Jun 22, 2023
d957e30
Flakifies pursProject
bladyjoker Jun 22, 2023
e2aae1c
Implements flake-purescript.nix wrapper for CTL's pursProject
bladyjoker Jun 22, 2023
8b23c91
Adds webpack so the bundler output works.
bladyjoker Jun 22, 2023
2b42666
Prints Json implements in Purescript (issues with ArrayBuffer -.-)
bladyjoker Jun 23, 2023
6356ce2
Implements Purescript Bytest newtype wrapper (-.-)
bladyjoker Jun 23, 2023
2baa9dc
Removes unnecessary Codegen tests
bladyjoker Jun 23, 2023
9781a24
Fixes build
bladyjoker Jun 23, 2023
c374944
Switches to 'name' instead of 'constructor' because controversy.
bladyjoker Jun 23, 2023
b3365cc
lbt-prelude-purs works
bladyjoker Jun 25, 2023
4fd74e6
lbt-prelude-purescript full test with Nixified 'data'
bladyjoker Jun 25, 2023
b46d660
Flake points to a CTL PR
bladyjoker Jun 25, 2023
fa0dac1
pre-commit fix
bladyjoker Jun 25, 2023
c8dcc59
Debugging
bladyjoker Jun 25, 2023
d95f2af
Debugging on
bladyjoker Jun 25, 2023
15b437a
Debugging
bladyjoker Jun 25, 2023
267000d
Debug
bladyjoker Jun 25, 2023
3a920a8
Debug
bladyjoker Jun 25, 2023
9c6047b
Debug
bladyjoker Jun 25, 2023
49407d0
Tries to fix doc generation
bladyjoker Jun 25, 2023
7b78e9d
Fix build
bladyjoker Jun 26, 2023
d22c43d
Configure webpack and run the lbr-prelude in the browser
bladyjoker Jun 26, 2023
247c368
webpack module name is `dist/output.js`
bladyjoker Jun 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 11 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
.direnv
.direnv
dist-newstyle
result
/.pre-commit-config.yaml
.vscode/
*~
*#*
.pre-commit-config.yaml
.pre-commit-config.yaml
**/node_modules
/.psc-package/
**/.psc*
**/.purs*
**/.psa*
**/.spago
**/.spago2nix
**/dist
**/output
15 changes: 0 additions & 15 deletions experimental/lbf-base/Plutus.lbf

This file was deleted.

15 changes: 0 additions & 15 deletions experimental/lbf-base/PreludeT.lbf

This file was deleted.

19 changes: 19 additions & 0 deletions extras/flake-purescript.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
pursProjOpts:
let
mkFlake = projectName: purs: {
packages = {
"purescript:${projectName}:lib" = purs.compiled;
"purescript:${projectName}:node-modules" = purs.nodeModules;
"purescript:${projectName}:bundle" = purs.bundlePursProject { main = "Test.Main"; entrypoint = "app/index.js"; bundledModuleName = "dist/output.js"; };
"purescript:${projectName}:docs" = purs.buildPursDocs { };
"purescript:${projectName}:docs-search" = purs.buildSearchablePursDocs { };
};

checks = {
"purescript:${projectName}:check" = purs.runPursTest { };
};

devShell = purs.devShell;
};
in
mkFlake pursProjOpts.projectName (pursProjOpts.pkgs.purescriptProject pursProjOpts)
38 changes: 38 additions & 0 deletions extras/haskell-data.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{ pkgs, srcs, cabalDataPatterns, cabalPackageName, cabalPackageVersion ? "0.1.0.0" }:
let
cabalTemplate = pkgs.writeTextFile {
name = "haskell-data.nix-cabal-template";
text = ''
cabal-version: 3.0
name: ${cabalPackageName}
version: ${cabalPackageVersion}
synopsis: A Cabal project that contains data files
build-type: Simple
data-files: ${builtins.concatStringsSep ", " (builtins.map (d: "data/${d}") cabalDataPatterns)}

library
default-language: Haskell2010
build-depends: base >=4.16
exposed-modules: Paths_${builtins.replaceStrings ["-"] ["_"] cabalPackageName}
'';
};
in
pkgs.stdenv.mkDerivation {
inherit srcs;
name = cabalPackageName;
buildInputs = [
pkgs.cabal-install
];
sourceRoot = ".";
buildPhase = ''
mkdir data;
cp -r -t data ${builtins.concatStringsSep " " (builtins.map (src: "${src}/*") srcs)};
cat ${cabalTemplate} > ${cabalPackageName}.cabal;
'';

installPhase = ''
mkdir $out;
cp -r data $out/;
mv ${cabalPackageName}.cabal $out/;
'';
}
52 changes: 39 additions & 13 deletions extras/lbf-haskell.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,36 @@
{ pkgs, src, lbfFile, importPaths, lbf, lbg-haskell, cabalPackageName, deps ? [ ], cabalPackageVersion ? "0.1.0.0" }:
# LambdaBuffers Frontend
lbf:
# LambdaBuffers Haskell Codegen
lbg-haskell:
{
# Nixpkgs
pkgs
, # Source that are passed to `lbf` as the `--import-path` flag and used to find `files`.
# Examples: src = [ ./api ]
src
, # Additional sources that are passed to `lbf` as the `--import-path` flag.
# Examples: imports = [ lbf-prelude ]
imports ? [ ]
, # .lbf files in `src` to compile and codegen.
# Examples: files = [ "Foo.lbf" "Foo/Bar.lbf" ]
files
, # Dependencies to include in the Cabal's `build-depends` stanza.
# examples: dependencies = [ "lbf-prelude" "lbr-prelude" ]
dependencies ? [ ]
, # Name of the package and also the name of the Cabal package.
# Examples: name = "lbf-myproject"
name
, # Version of the package and also the version of the Cabal package.
# Examples: version = "0.1.0.0"
version ? "0.1.0.0"
}:
let
importPaths' = builtins.concatStringsSep " " (builtins.map (imp: "--import-path ${imp}") importPaths);
providedDeps = builtins.concatStringsSep " " (builtins.map (dep: dep.name) deps);
cabalTemplate = pkgs.writeTextFile {
name = "lambda-buffers-cabal-template";
text = ''
cabal-version: 3.0
name: ${cabalPackageName}
version: ${cabalPackageVersion}
name: ${name}
version: ${version}
synopsis: A Cabal project that contains LambdaBuffers generated Haskell modules
build-type: Simple

Expand All @@ -23,8 +46,8 @@ let
};
in
pkgs.stdenv.mkDerivation {
inherit src;
name = cabalPackageName;
inherit src version;
pname = name;
outputs = [ "out" "build" ];
buildInputs = [
pkgs.cabal-install
Expand All @@ -34,25 +57,28 @@ pkgs.stdenv.mkDerivation {
buildPhase = ''
mkdir autogen
mkdir .work
lbf build ${importPaths'} \
--file ${src}/${lbfFile} \
ls
lbf build ${builtins.concatStringsSep " " (builtins.map (src: "--import-path ${src}") ([src] ++ imports))} \
--work-dir .work \
--gen ${lbg-haskell}/bin/lbg-haskell \
--gen-dir autogen
--gen-dir autogen \
${builtins.concatStringsSep " " files}

EXPOSED_MODULES=$(find autogen -name "*.hs" | while read f; do grep -Eo 'module\s+\S+\s+' $f | head -n 1 | sed -r 's/module\s+//' | sed -r 's/\s+//'; done | tr '\n' ' ')
echo "Found generated modules $EXPOSED_MODULES"
DEPS=$(echo ${providedDeps} $(cat autogen/build.json | jq -r ".[]") | tr ' ' ',' | sed 's/.$//')
DEPS=$(echo ${builtins.concatStringsSep " " dependencies} base $(cat autogen/build.json | jq -r ".[]") | sort -nu | tr ' ' ',' | sed 's/$//')

cat ${cabalTemplate} \
| sed -r "s/<EXPOSED_MODULES>/$EXPOSED_MODULES/" \
| sed -r "s/<DEPS>/$DEPS/" > ${cabalPackageName}.cabal
| sed -r "s/<DEPS>/$DEPS/" > ${name}.cabal
cat ${name}.cabal
cat autogen/build.json
'';

installPhase = ''
mkdir -p $out/autogen;
cp -r autogen $out
cp ${cabalPackageName}.cabal $out/${cabalPackageName}.cabal;
cp ${name}.cabal $out/${name}.cabal;
mv autogen/build.json $build;
'';
}
53 changes: 53 additions & 0 deletions extras/lbf-purescript.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# LambdaBuffers Frontend
lbf:
# LambdaBuffers Purescript Codegen
lbg-purescript:
{
# Nixpkgs
pkgs
, # Source that are passed to `lbf` as the `--import-path` flag and used to find `files`.
# Examples: src = [ ./api ]
src
, # Additional sources that are passed to `lbf` as the `--import-path` flag.
# Examples: imports = [ lbf-prelude ]
imports ? [ ]
, # .lbf files in `src` to compile and codegen.
# Examples: files = [ "Foo.lbf" "Foo/Bar.lbf" ]
files
, # TODO(bladyjoker): Dependencies to include in the `build` output
# examples: dependencies = [ "lbf-prelude" "lbr-prelude" ]
dependencies ? [ ]
, # Package name.
# Examples: name = "lbf-myproject"
name
, # Package version.
# Examples: version = "0.1.0.0"
version ? "0.1.0.0"
}:
pkgs.stdenv.mkDerivation {
inherit src version;
pname = name;
outputs = [ "out" "build" ];
buildInputs = [
pkgs.cabal-install
lbf
pkgs.jq
];
buildPhase = ''
mkdir autogen
mkdir .work
lbf build ${builtins.concatStringsSep " " (builtins.map (src: "--import-path ${src}") ([src] ++ imports))} \
--work-dir .work \
--gen ${lbg-purescript}/bin/lbg-purescript \
--gen-dir autogen \
${builtins.concatStringsSep " " files}

cat autogen/build.json
'';

installPhase = ''
mkdir -p $out/src;
cp -r autogen/* $out/src
mv autogen/build.json $build;
'';
}
Loading