This commit is contained in:
justinwoo 2021-07-25 17:05:11 +03:00
parent 8e961bc055
commit 5319a2f3dd

View File

@ -2235,7 +2235,7 @@ var PS = {};
delete fibers[fid];
};
}
});
})();
fibers[fid] = fiber;
count++;
},
@ -2349,6 +2349,7 @@ var PS = {};
switch (status) {
case STEP_BIND:
status = CONTINUE;
try {
step = bhead(step);
if (btail === null) {
bhead = null;
@ -2356,6 +2357,11 @@ var PS = {};
bhead = btail._1;
btail = btail._2;
}
} catch (e) {
status = RETURN;
fail = util.left(e);
step = null;
}
break;
case STEP_RESULT:
@ -3428,15 +3434,15 @@ var PS = {};
var Effect_Class = $PS["Effect.Class"];
var Effect_Console = $PS["Effect.Console"];
var log = function (dictMonadEffect) {
var $26 = Effect_Class.liftEffect(dictMonadEffect);
return function ($27) {
return $26(Effect_Console.log($27));
var $30 = Effect_Class.liftEffect(dictMonadEffect);
return function ($31) {
return $30(Effect_Console.log($31));
};
};
var error = function (dictMonadEffect) {
var $36 = Effect_Class.liftEffect(dictMonadEffect);
return function ($37) {
return $36(Effect_Console.error($37));
var $40 = Effect_Class.liftEffect(dictMonadEffect);
return function ($41) {
return $40(Effect_Console.error($41));
};
};
exports["log"] = log;
@ -6379,31 +6385,553 @@ var PS = {};
};
};
})(PS["Node.Stream"] = PS["Node.Stream"] || {});
(function($PS) {
// Generated by purs version 0.13.8
"use strict";
$PS["Node.Buffer.Class"] = $PS["Node.Buffer.Class"] || {};
var exports = $PS["Node.Buffer.Class"];
var MutableBuffer = function (Monad0, concat, concat$prime, copy, create, fill, freeze, fromArray, fromArrayBuffer, fromString, getAtOffset, read, readString, setAtOffset, size, slice, thaw, toArray, toArrayBuffer, toString, unsafeFreeze, unsafeThaw, write, writeString) {
this.Monad0 = Monad0;
this.concat = concat;
this["concat'"] = concat$prime;
this.copy = copy;
this.create = create;
this.fill = fill;
this.freeze = freeze;
this.fromArray = fromArray;
this.fromArrayBuffer = fromArrayBuffer;
this.fromString = fromString;
this.getAtOffset = getAtOffset;
this.read = read;
this.readString = readString;
this.setAtOffset = setAtOffset;
this.size = size;
this.slice = slice;
this.thaw = thaw;
this.toArray = toArray;
this.toArrayBuffer = toArrayBuffer;
this.toString = toString;
this.unsafeFreeze = unsafeFreeze;
this.unsafeThaw = unsafeThaw;
this.write = write;
this.writeString = writeString;
};
var toString = function (dict) {
return dict.toString;
};
exports["MutableBuffer"] = MutableBuffer;
exports["toString"] = toString;
})(PS);
(function(exports) {
/* global exports */
/* global Buffer */
"use strict";
exports.copyAll = function(a) {
return function() {
return Buffer.from(a);
};
};
exports.writeInternal = function (ty) {
return function (value) {
return function (offset) {
return function (buf) {
return function() {
buf['write' + ty](value, offset);
return {};
}
};
};
};
};
exports.writeStringInternal = function (encoding) {
return function (offset) {
return function (length) {
return function (value) {
return function (buff) {
return function() {
return buff.write(value, offset, length, encoding);
}
};
};
};
};
};
exports.setAtOffset = function (value) {
return function (offset) {
return function (buff) {
return function() {
buff[offset] = value;
return {};
};
};
};
};
exports.copy = function (srcStart) {
return function (srcEnd) {
return function (src) {
return function (targStart) {
return function (targ) {
return function() {
return src.copy(targ, targStart, srcStart, srcEnd);
};
};
};
};
};
};
exports.fill = function (octet) {
return function (start) {
return function (end) {
return function (buf) {
return function() {
buf.fill(octet, start, end);
return {};
};
};
};
};
};
})(PS["Node.Buffer.Internal"] = PS["Node.Buffer.Internal"] || {});
(function(exports) {
/* global exports */
/* global Buffer */
/* global require */
"use strict";
exports.create = function (size) {
return Buffer.alloc(size);
};
exports.fromArray = function (octets) {
return Buffer.from(octets);
};
exports.size = function (buff) {
return buff.length;
};
exports.toArray = function (buff) {
var json = buff.toJSON()
return json.data || json;
};
exports.toArrayBuffer = function(buff) {
return buff.buffer.slice(buff.byteOffset, buff.byteOffset + buff.byteLength);
};
exports.fromArrayBuffer = function(ab) {
return Buffer.from(ab);
};
exports.fromStringImpl = function (str) {
return function (encoding) {
return Buffer.from(str, encoding);
};
};
exports.readImpl = function (ty) {
return function (offset) {
return function (buf) {
return buf['read' + ty](offset);
};
};
};
exports.readStringImpl = function (enc) {
return function (start) {
return function (end) {
return function (buff) {
return buff.toString(enc, start, end);
};
};
};
};
exports.getAtOffsetImpl = function (just) {
return function (nothing) {
return function (offset) {
return function (buff) {
var octet = buff[offset];
return octet == null ? nothing
: just(octet);
};
};
};
};
exports.toStringImpl = function (enc) {
return function (buff) {
return function() {
return buff.toString(enc);
};
};
exports.slice = function (start) {
return function (end) {
return function (buff) {
return buff.slice(start, end);
};
})(PS["Node.Buffer"] = PS["Node.Buffer"] || {});
};
};
exports.concat = function (buffs) {
return Buffer.concat(buffs);
};
exports["concat'"] = function (buffs) {
return function (totalLength) {
return Buffer.concat(buffs, totalLength);
};
};
})(PS["Node.Buffer.Immutable"] = PS["Node.Buffer.Immutable"] || {});
(function($PS) {
// Generated by purs version 0.13.8
"use strict";
$PS["Node.Buffer.Types"] = $PS["Node.Buffer.Types"] || {};
var exports = $PS["Node.Buffer.Types"];
var Data_Show = $PS["Data.Show"];
var UInt8 = (function () {
function UInt8() {
};
UInt8.value = new UInt8();
return UInt8;
})();
var UInt16LE = (function () {
function UInt16LE() {
};
UInt16LE.value = new UInt16LE();
return UInt16LE;
})();
var UInt16BE = (function () {
function UInt16BE() {
};
UInt16BE.value = new UInt16BE();
return UInt16BE;
})();
var UInt32LE = (function () {
function UInt32LE() {
};
UInt32LE.value = new UInt32LE();
return UInt32LE;
})();
var UInt32BE = (function () {
function UInt32BE() {
};
UInt32BE.value = new UInt32BE();
return UInt32BE;
})();
var Int8 = (function () {
function Int8() {
};
Int8.value = new Int8();
return Int8;
})();
var Int16LE = (function () {
function Int16LE() {
};
Int16LE.value = new Int16LE();
return Int16LE;
})();
var Int16BE = (function () {
function Int16BE() {
};
Int16BE.value = new Int16BE();
return Int16BE;
})();
var Int32LE = (function () {
function Int32LE() {
};
Int32LE.value = new Int32LE();
return Int32LE;
})();
var Int32BE = (function () {
function Int32BE() {
};
Int32BE.value = new Int32BE();
return Int32BE;
})();
var FloatLE = (function () {
function FloatLE() {
};
FloatLE.value = new FloatLE();
return FloatLE;
})();
var FloatBE = (function () {
function FloatBE() {
};
FloatBE.value = new FloatBE();
return FloatBE;
})();
var DoubleLE = (function () {
function DoubleLE() {
};
DoubleLE.value = new DoubleLE();
return DoubleLE;
})();
var DoubleBE = (function () {
function DoubleBE() {
};
DoubleBE.value = new DoubleBE();
return DoubleBE;
})();
var showBufferValueType = new Data_Show.Show(function (v) {
if (v instanceof UInt8) {
return "UInt8";
};
if (v instanceof UInt16LE) {
return "UInt16LE";
};
if (v instanceof UInt16BE) {
return "UInt16BE";
};
if (v instanceof UInt32LE) {
return "UInt32LE";
};
if (v instanceof UInt32BE) {
return "UInt32BE";
};
if (v instanceof Int8) {
return "Int8";
};
if (v instanceof Int16LE) {
return "Int16LE";
};
if (v instanceof Int16BE) {
return "Int16BE";
};
if (v instanceof Int32LE) {
return "Int32LE";
};
if (v instanceof Int32BE) {
return "Int32BE";
};
if (v instanceof FloatLE) {
return "FloatLE";
};
if (v instanceof FloatBE) {
return "FloatBE";
};
if (v instanceof DoubleLE) {
return "DoubleLE";
};
if (v instanceof DoubleBE) {
return "DoubleBE";
};
throw new Error("Failed pattern match at Node.Buffer.Types (line 33, column 1 - line 47, column 29): " + [ v.constructor.name ]);
});
exports["showBufferValueType"] = showBufferValueType;
})(PS);
(function($PS) {
// Generated by purs version 0.13.8
"use strict";
$PS["Node.Buffer.Immutable"] = $PS["Node.Buffer.Immutable"] || {};
var exports = $PS["Node.Buffer.Immutable"];
var $foreign = $PS["Node.Buffer.Immutable"];
var Data_Maybe = $PS["Data.Maybe"];
var Data_Show = $PS["Data.Show"];
var Node_Buffer_Types = $PS["Node.Buffer.Types"];
var Node_Encoding = $PS["Node.Encoding"];
var toString = function ($3) {
return $foreign.toStringImpl(Node_Encoding.encodingToNode($3));
};
var readString = function ($4) {
return $foreign.readStringImpl(Node_Encoding.encodingToNode($4));
};
var read = (function () {
var $5 = Data_Show.show(Node_Buffer_Types.showBufferValueType);
return function ($6) {
return $foreign.readImpl($5($6));
};
})();
var getAtOffset = $foreign.getAtOffsetImpl(Data_Maybe.Just.create)(Data_Maybe.Nothing.value);
var fromString = function (str) {
var $7 = $foreign.fromStringImpl(str);
return function ($8) {
return $7(Node_Encoding.encodingToNode($8));
};
};
exports["fromString"] = fromString;
exports["read"] = read;
exports["readString"] = readString;
exports["toString"] = toString;
exports["getAtOffset"] = getAtOffset;
exports["create"] = $foreign.create;
exports["fromArray"] = $foreign.fromArray;
exports["fromArrayBuffer"] = $foreign.fromArrayBuffer;
exports["toArray"] = $foreign.toArray;
exports["toArrayBuffer"] = $foreign.toArrayBuffer;
exports["concat"] = $foreign.concat;
exports["concat'"] = $foreign["concat'"];
exports["slice"] = $foreign.slice;
exports["size"] = $foreign.size;
})(PS);
(function($PS) {
// Generated by purs version 0.13.8
"use strict";
$PS["Node.Buffer.Internal"] = $PS["Node.Buffer.Internal"] || {};
var exports = $PS["Node.Buffer.Internal"];
var $foreign = $PS["Node.Buffer.Internal"];
var Control_Applicative = $PS["Control.Applicative"];
var Data_Functor = $PS["Data.Functor"];
var Data_Show = $PS["Data.Show"];
var Node_Buffer_Immutable = $PS["Node.Buffer.Immutable"];
var Node_Buffer_Types = $PS["Node.Buffer.Types"];
var Node_Encoding = $PS["Node.Encoding"];
var writeString = function (dictMonad) {
return function ($20) {
return $foreign.writeStringInternal(Node_Encoding.encodingToNode($20));
};
};
var write = function (dictMonad) {
var $21 = Data_Show.show(Node_Buffer_Types.showBufferValueType);
return function ($22) {
return $foreign.writeInternal($21($22));
};
};
var unsafeThaw = function (dictMonad) {
var $23 = Control_Applicative.pure(dictMonad.Applicative0());
return function ($24) {
return $23($24);
};
};
var usingToImmutable = function (dictMonad) {
return function (f) {
return function (x) {
return unsafeThaw(dictMonad)(f(x));
};
};
};
var unsafeFreeze = function (dictMonad) {
var $25 = Control_Applicative.pure(dictMonad.Applicative0());
return function ($26) {
return $25($26);
};
};
var usingFromImmutable = function (dictMonad) {
return function (f) {
return function (buf) {
return Data_Functor.map(((dictMonad.Bind1()).Apply0()).Functor0())(f)(unsafeFreeze(dictMonad)(buf));
};
};
};
var toString = function (dictMonad) {
return function (m) {
return usingFromImmutable(dictMonad)(Node_Buffer_Immutable.toString(m));
};
};
var toArrayBuffer = function (dictMonad) {
return usingFromImmutable(dictMonad)(Node_Buffer_Immutable.toArrayBuffer);
};
var toArray = function (dictMonad) {
return usingFromImmutable(dictMonad)(Node_Buffer_Immutable.toArray);
};
var slice = Node_Buffer_Immutable.slice;
var size = function (dictMonad) {
return usingFromImmutable(dictMonad)(Node_Buffer_Immutable.size);
};
var readString = function (dictMonad) {
return function (m) {
return function (o) {
return function (o$prime) {
return usingFromImmutable(dictMonad)(Node_Buffer_Immutable.readString(m)(o)(o$prime));
};
};
};
};
var read = function (dictMonad) {
return function (t) {
return function (o) {
return usingFromImmutable(dictMonad)(Node_Buffer_Immutable.read(t)(o));
};
};
};
var getAtOffset = function (dictMonad) {
return function (o) {
return usingFromImmutable(dictMonad)(Node_Buffer_Immutable.getAtOffset(o));
};
};
var fromString = function (dictMonad) {
return function (s) {
return usingToImmutable(dictMonad)(Node_Buffer_Immutable.fromString(s));
};
};
var fromArrayBuffer = function (dictMonad) {
return usingToImmutable(dictMonad)(Node_Buffer_Immutable.fromArrayBuffer);
};
var fromArray = function (dictMonad) {
return usingToImmutable(dictMonad)(Node_Buffer_Immutable.fromArray);
};
var create = function (dictMonad) {
return usingToImmutable(dictMonad)(Node_Buffer_Immutable.create);
};
var concat$prime = function (dictMonad) {
return function (arrs) {
return function (n) {
return function (v) {
return Node_Buffer_Immutable["concat'"](arrs)(n);
};
};
};
};
var concat = function (arrs) {
return function (v) {
return Node_Buffer_Immutable.concat(arrs);
};
};
exports["unsafeFreeze"] = unsafeFreeze;
exports["unsafeThaw"] = unsafeThaw;
exports["create"] = create;
exports["fromArray"] = fromArray;
exports["fromString"] = fromString;
exports["fromArrayBuffer"] = fromArrayBuffer;
exports["toArrayBuffer"] = toArrayBuffer;
exports["read"] = read;
exports["readString"] = readString;
exports["toString"] = toString;
exports["write"] = write;
exports["writeString"] = writeString;
exports["toArray"] = toArray;
exports["getAtOffset"] = getAtOffset;
exports["slice"] = slice;
exports["size"] = size;
exports["concat"] = concat;
exports["concat'"] = concat$prime;
exports["copyAll"] = $foreign.copyAll;
exports["setAtOffset"] = $foreign.setAtOffset;
exports["copy"] = $foreign.copy;
exports["fill"] = $foreign.fill;
})(PS);
(function($PS) {
// Generated by purs version 0.13.8
"use strict";
$PS["Node.Buffer"] = $PS["Node.Buffer"] || {};
var exports = $PS["Node.Buffer"];
var $foreign = $PS["Node.Buffer"];
var Node_Encoding = $PS["Node.Encoding"];
var toString = function ($3) {
return $foreign.toStringImpl(Node_Encoding.encodingToNode($3));
};
exports["toString"] = toString;
var Effect = $PS["Effect"];
var Node_Buffer_Class = $PS["Node.Buffer.Class"];
var Node_Buffer_Internal = $PS["Node.Buffer.Internal"];
var mutableBufferEffect = new Node_Buffer_Class.MutableBuffer(function () {
return Effect.monadEffect;
}, Node_Buffer_Internal.concat, Node_Buffer_Internal["concat'"](Effect.monadEffect), Node_Buffer_Internal.copy, Node_Buffer_Internal.create(Effect.monadEffect), Node_Buffer_Internal.fill, Node_Buffer_Internal.copyAll, Node_Buffer_Internal.fromArray(Effect.monadEffect), Node_Buffer_Internal.fromArrayBuffer(Effect.monadEffect), Node_Buffer_Internal.fromString(Effect.monadEffect), Node_Buffer_Internal.getAtOffset(Effect.monadEffect), Node_Buffer_Internal.read(Effect.monadEffect), Node_Buffer_Internal.readString(Effect.monadEffect), Node_Buffer_Internal.setAtOffset, Node_Buffer_Internal.size(Effect.monadEffect), Node_Buffer_Internal.slice, Node_Buffer_Internal.copyAll, Node_Buffer_Internal.toArray(Effect.monadEffect), Node_Buffer_Internal.toArrayBuffer(Effect.monadEffect), Node_Buffer_Internal.toString(Effect.monadEffect), Node_Buffer_Internal.unsafeFreeze(Effect.monadEffect), Node_Buffer_Internal.unsafeThaw(Effect.monadEffect), Node_Buffer_Internal.write(Effect.monadEffect), Node_Buffer_Internal.writeString(Effect.monadEffect));
exports["mutableBufferEffect"] = mutableBufferEffect;
})(PS);
(function($PS) {
// Generated by purs version 0.13.8
@ -6418,6 +6946,7 @@ var PS = {};
var Effect = $PS["Effect"];
var Effect_Exception = $PS["Effect.Exception"];
var Node_Buffer = $PS["Node.Buffer"];
var Node_Buffer_Class = $PS["Node.Buffer.Class"];
var Node_Encoding = $PS["Node.Encoding"];
var writeString = function (w) {
return function (enc) {
@ -6447,7 +6976,7 @@ var PS = {};
var onDataString = function (r) {
return function (enc) {
return function (cb) {
return onData(r)(Control_Bind.composeKleisliFlipped(Effect.bindEffect)(cb)(Node_Buffer.toString(enc)));
return onData(r)(Control_Bind.composeKleisliFlipped(Effect.bindEffect)(cb)(Node_Buffer_Class.toString(Node_Buffer.mutableBufferEffect)(enc)));
};
};
};
@ -7047,7 +7576,48 @@ var PS = {};
$PS["Data.List"] = $PS["Data.List"] || {};
var exports = $PS["Data.List"];
var Data_Foldable = $PS["Data.Foldable"];
var Data_Functor = $PS["Data.Functor"];
var Data_List_Types = $PS["Data.List.Types"];
var Data_Maybe = $PS["Data.Maybe"];
var Data_Tuple = $PS["Data.Tuple"];
var Data_Unfoldable = $PS["Data.Unfoldable"];
var uncons = function (v) {
if (v instanceof Data_List_Types.Nil) {
return Data_Maybe.Nothing.value;
};
if (v instanceof Data_List_Types.Cons) {
return new Data_Maybe.Just({
head: v.value0,
tail: v.value1
});
};
throw new Error("Failed pattern match at Data.List (line 259, column 1 - line 259, column 66): " + [ v.constructor.name ]);
};
var toUnfoldable = function (dictUnfoldable) {
return Data_Unfoldable.unfoldr(dictUnfoldable)(function (xs) {
return Data_Functor.map(Data_Maybe.functorMaybe)(function (rec) {
return new Data_Tuple.Tuple(rec.head, rec.tail);
})(uncons(xs));
});
};
var tail = function (v) {
if (v instanceof Data_List_Types.Nil) {
return Data_Maybe.Nothing.value;
};
if (v instanceof Data_List_Types.Cons) {
return new Data_Maybe.Just(v.value1);
};
throw new Error("Failed pattern match at Data.List (line 245, column 1 - line 245, column 43): " + [ v.constructor.name ]);
};
var head = function (v) {
if (v instanceof Data_List_Types.Nil) {
return Data_Maybe.Nothing.value;
};
if (v instanceof Data_List_Types.Cons) {
return new Data_Maybe.Just(v.value0);
};
throw new Error("Failed pattern match at Data.List (line 230, column 1 - line 230, column 22): " + [ v.constructor.name ]);
};
var fromFoldable = function (dictFoldable) {
return Data_Foldable.foldr(dictFoldable)(Data_List_Types.Cons.create)(Data_List_Types.Nil.value);
};
@ -7078,6 +7648,7 @@ var PS = {};
return $tco_result;
};
};
exports["toUnfoldable"] = toUnfoldable;
exports["fromFoldable"] = fromFoldable;
exports["drop"] = drop;
})(PS);
@ -7370,7 +7941,6 @@ var PS = {};
exports["exists"] = exists;
})(PS);
(function($PS) {
// Generated by purs version 0.13.8
"use strict";
$PS["Generate"] = $PS["Generate"] || {};
var exports = $PS["Generate"];
@ -7389,6 +7959,8 @@ var PS = {};
var Data_Eq = $PS["Data.Eq"];
var Data_Foldable = $PS["Data.Foldable"];
var Data_Functor = $PS["Data.Functor"];
var Data_List = $PS["Data.List"];
var Data_List_Types = $PS["Data.List.Types"];
var Data_Maybe = $PS["Data.Maybe"];
var Data_Monoid = $PS["Data.Monoid"];
var Data_Semigroup = $PS["Data.Semigroup"];
@ -7396,6 +7968,7 @@ var PS = {};
var Data_String_Common = $PS["Data.String.Common"];
var Data_Symbol = $PS["Data.Symbol"];
var Data_Traversable = $PS["Data.Traversable"];
var Data_Unfoldable = $PS["Data.Unfoldable"];
var Data_Unit = $PS["Data.Unit"];
var Data_Validation_Semigroup = $PS["Data.Validation.Semigroup"];
var Effect_Aff = $PS["Effect.Aff"];
@ -7406,18 +7979,36 @@ var PS = {};
var Simple_JSON = $PS["Simple.JSON"];
var Simple_JSON_Utils = $PS["Simple.JSON.Utils"];
var Sunde = $PS["Sunde"];
var unSpagoArgs = function (v) {
return Data_List.toUnfoldable(Data_Unfoldable.unfoldableArray)(v);
};
var template = "# This file was generated by Spago2Nix\x0a\x0a{ pkgs ? import <nixpkgs> {} }:\x0a\x0alet\x0a inputs = {\x0aINPUTS\x0a };\x0a\x0a cpPackage = pkg:\x0a let\x0a target = \".spago/${pkg.name}/${pkg.version}\";\x0a in ''\x0a if [ ! -e ${target} ]; then\x0a echo \"Installing ${target}.\"\x0a mkdir -p ${target}\x0a cp --no-preserve=mode,ownership,timestamp -r ${toString pkg.outPath}/* ${target}\x0a else\x0a echo \"${target} already exists. Skipping.\"\x0a fi\x0a '';\x0a\x0a getGlob = pkg: ''\".spago/${pkg.name}/${pkg.version}/src/**/*.purs\"'';\x0a\x0a getStoreGlob = pkg: ''\"${pkg.outPath}/src/**/*.purs\"'';\x0a\x0ain {\x0a inherit inputs;\x0a\x0a installSpagoStyle = pkgs.writeShellScriptBin \"install-spago-style\" ''\x0a set -e\x0a echo installing dependencies...\x0a ${builtins.toString (builtins.map cpPackage (builtins.attrValues inputs))}\x0a echo \"echo done.\"\x0a '';\x0a\x0a buildSpagoStyle = pkgs.writeShellScriptBin \"build-spago-style\" ''\x0a set -e\x0a echo building project...\x0a purs compile ${builtins.toString (builtins.map getGlob (builtins.attrValues inputs))} \"$@\"\x0a echo done.\x0a '';\x0a\x0a buildFromNixStore = pkgs.writeShellScriptBin \"build-from-store\" ''\x0a set -e\x0a echo building project using sources from nix store...\x0a purs compile ${builtins.toString (\x0a builtins.map getStoreGlob (builtins.attrValues inputs))} \"$@\"\x0a echo done.\x0a '';\x0a\x0a mkBuildProjectOutput =\x0a { src, purs }:\x0a\x0a pkgs.stdenv.mkDerivation {\x0a name = \"build-project-output\";\x0a src = src;\x0a\x0a buildInputs = [ purs ];\x0a\x0a installPhase = ''\x0a mkdir -p $out\x0a purs compile \"$src/**/*.purs\" ${builtins.toString\x0a (builtins.map\x0a (x: ''\"${x.outPath}/src/**/*.purs\"'')\x0a (builtins.attrValues inputs))}\x0a mv output $out\x0a '';\x0a };\x0a}\x0a";
var spagoListPackages = (function () {
// # e.g. when you nix-prefetch-git
// # when you have a valid reference:
// $ nix-prefetch-git https://github.com/purescript/purescript-unsafe-coerce.git --rev v4.0.0 --quiet
// {
// "rev": "fa6a5ca9b4581c00ee0b8539306a49badb7bee60",
// "sha256": "0k9255mk2mz6xjb11pwkgfcblmmyvr86ig5kr92jwy95xim09zip",
// }
// # when you don't
// $ nix-prefetch-git https://github.com/purescript/purescript-unsafe-coerce.git --rev v4.0.j0 --quiet
// {
// "rev": "refs/heads/fetchgit",
// "sha256": "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5",
// }
var spagoListPackages = function (mSpagoArgs) {
var words = (function () {
var $61 = Data_String_Common.split("\x0a");
return function ($62) {
return $61(Data_String_Common.trim($62));
var $69 = Data_String_Common.split("\x0a");
return function ($70) {
return $69(Data_String_Common.trim($70));
};
})();
var spagoArgs = Data_Maybe.maybe([ ])(unSpagoArgs)(mSpagoArgs);
return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(Effect_Class_Console.error(Effect_Aff.monadEffectAff)("getting packages.."))(function () {
return Control_Bind.bind(Effect_Aff.bindAff)(Sunde.spawn({
cmd: "spago",
args: [ "ls", "deps", "--json", "--transitive" ],
args: Data_Semigroup.append(Data_Semigroup.semigroupArray)([ "ls", "deps", "--json", "--transitive" ])(spagoArgs),
stdin: Data_Maybe.Nothing.value
})(Node_ChildProcess.defaultSpawnOptions))(function (output) {
if (output.exit instanceof Node_ChildProcess.Normally && output.exit.value0 === 0) {
@ -7433,7 +8024,7 @@ var PS = {};
});
});
});
})();
};
var replace = function (v) {
return Data_String_Common.replaceAll(v.from)(v.to);
};
@ -7465,7 +8056,7 @@ var PS = {};
to: v.value0.result.sha256
})("\x0a \"PKGNAME\" = pkgs.stdenv.mkDerivation {\x0a name = \"PKGNAME\";\x0a version = \"VERSION\";\x0a src = pkgs.fetchgit {\x0a url = \"URL\";\x0a rev = \"REV\";\x0a sha256 = \"SHA256\";\x0a };\x0a phases = \"installPhase\";\x0a installPhase = \"ln -s $src $out\";\x0a };\x0a")))));
};
throw new Error("Failed pattern match at Generate (line 194, column 1 - line 194, column 37): " + [ v.constructor.name ]);
throw new Error("Failed pattern match at Generate (line 197, column 1 - line 197, column 37): " + [ v.constructor.name ]);
};
var printResults = function (xs) {
var inputs = Data_Foldable.foldMap(Data_Foldable.foldableArray)(Data_Monoid.monoidString)(printResult)(xs);
@ -7474,6 +8065,32 @@ var PS = {};
to: inputs
})(template);
};
var parseSpagoArgs = function (xs) {
var go = function ($copy_v) {
var $tco_done = false;
var $tco_result;
function $tco_loop(v) {
if (v instanceof Data_List_Types.Cons && v.value0 === "--") {
$tco_done = true;
return Data_Maybe.Just.create(v.value1);
};
if (v instanceof Data_List_Types.Cons) {
$copy_v = v.value1;
return;
};
if (v instanceof Data_List_Types.Nil) {
$tco_done = true;
return Data_Maybe.Nothing.value;
};
throw new Error("Failed pattern match at Generate (line 279, column 5 - line 279, column 53): " + [ v.constructor.name ]);
};
while (!$tco_done) {
$tco_result = $tco_loop($copy_v);
};
return $tco_result;
};
return go(xs);
};
var mkPrefetchPath = function (v) {
return "./.spago2nix/" + (v.packageName + ("@" + (v.version + ".json")));
};
@ -7516,9 +8133,11 @@ var PS = {};
};
return chunk$prime([ ])(v1);
};
throw new Error("Failed pattern match at Generate (line 231, column 1 - line 231, column 53): " + [ v.constructor.name, v1.constructor.name ]);
throw new Error("Failed pattern match at Generate (line 234, column 1 - line 234, column 53): " + [ v.constructor.name, v1.constructor.name ]);
};
};
// | Magic SHA256 for broken fetches from nix-prefetch-git, see below notes
var brokenRepoSHA = "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5";
var fetchPackage = function (v) {
if (v.repo instanceof Core.Local) {
@ -7550,10 +8169,10 @@ var PS = {};
if (v1 instanceof Data_Either.Left) {
return Control_Monad_Error_Class.throwError(Control_Monad_Except_Trans.monadThrowExceptT(Effect_Aff.monadAff))(new Core.NixPrefetchGitOutputDeformed(Simple_JSON_Utils.printMultipleErrors(v1.value0)));
};
throw new Error("Failed pattern match at Generate (line 81, column 37 - line 83, column 88): " + [ v1.constructor.name ]);
throw new Error("Failed pattern match at Generate (line 84, column 37 - line 86, column 88): " + [ v1.constructor.name ]);
})())(function (v1) {
var $44 = Data_Eq.eq(Core.eqSHA)(v1.sha256)(brokenRepoSHA);
if ($44) {
var $52 = Data_Eq.eq(Core.eqSHA)(v1.sha256)(brokenRepoSHA);
if ($52) {
return Control_Monad_Error_Class.throwError(Control_Monad_Except_Trans.monadThrowExceptT(Effect_Aff.monadAff))(new Core.MissingRevOrRepoResult(Data_Show.show(Data_Show.showRecord()(Data_Show.showRecordFieldsCons(new Data_Symbol.IsSymbol(function () {
return "packageName";
}))(Data_Show.showRecordFieldsCons(new Data_Symbol.IsSymbol(function () {
@ -7570,7 +8189,7 @@ var PS = {};
});
}));
};
throw new Error("Failed pattern match at Generate (line 66, column 1 - line 66, column 60): " + [ v.constructor.name ]);
throw new Error("Failed pattern match at Generate (line 69, column 1 - line 69, column 60): " + [ v.constructor.name ]);
};
var ensureFetchPackage = function (p) {
var path = mkPrefetchPath(p);
@ -7585,7 +8204,7 @@ var PS = {};
if (v instanceof Data_Either.Left) {
return Control_Applicative.pure(Effect_Aff.applicativeAff)(Data_Either.Left.create(new Core.FileContentsCorrupted(p, path, Simple_JSON_Utils.printMultipleErrors(v.value0))));
};
throw new Error("Failed pattern match at Generate (line 96, column 7 - line 98, column 85): " + [ v.constructor.name ]);
throw new Error("Failed pattern match at Generate (line 99, column 7 - line 101, column 85): " + [ v.constructor.name ]);
});
});
};
@ -7599,12 +8218,13 @@ var PS = {};
return Control_Applicative.pure(Effect_Aff.applicativeAff)(result);
});
};
throw new Error("Failed pattern match at Generate (line 102, column 7 - line 106, column 22): " + [ result.constructor.name ]);
throw new Error("Failed pattern match at Generate (line 105, column 7 - line 109, column 22): " + [ result.constructor.name ]);
});
});
});
};
var generate = function (maxProcs) {
return function (mSpagoArgs) {
var toResult = function (xs) {
return Data_Validation_Semigroup.toEither(Data_Traversable.traverse(Data_Traversable.traversableArray)(Data_Validation_Semigroup.applicativeV(Data_Semigroup.semigroupArray))(Data_Validation_Semigroup.V)(Data_Functor.map(Data_Functor.functorArray)(Data_Bifunctor.lmap(Data_Either.bifunctorEither)(Control_Applicative.pure(Control_Applicative.applicativeArray)))(xs)));
};
@ -7618,19 +8238,19 @@ var PS = {};
return Core.exit(1);
});
};
throw new Error("Failed pattern match at Generate (line 261, column 7 - line 265, column 17): " + [ result.constructor.name ]);
throw new Error("Failed pattern match at Generate (line 264, column 7 - line 268, column 17): " + [ result.constructor.name ]);
});
};
return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(ensureSetup)(function () {
return Control_Bind.bind(Effect_Aff.bindAff)(exitOnError(spagoListPackages))(function (packages) {
return Control_Bind.bind(Effect_Aff.bindAff)(exitOnError(spagoListPackages(mSpagoArgs)))(function (packages) {
return Control_Bind.bind(Effect_Aff.bindAff)(Data_Functor.map(Effect_Aff.functorAff)(toResult)(concatMapM(Effect_Aff.monadAff)(Control_Parallel.parTraverse(Effect_Aff.parallelAff)(Data_Traversable.traversableArray)(ensureFetchPackage))(chunk(maxProcs)(packages))))(function (fetches) {
if (fetches instanceof Data_Either.Left) {
return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(Effect_Class_Console.error(Effect_Aff.monadEffectAff)("errors from fetching packages:"))(function () {
return Control_Bind.discard(Control_Bind.discardUnit)(Effect_Aff.bindAff)(Data_Foldable.traverse_(Effect_Aff.applicativeAff)(Data_Foldable.foldableArray)((function () {
var $63 = Effect_Class_Console.error(Effect_Aff.monadEffectAff);
var $64 = Data_Show.show(Core.showMyError);
return function ($65) {
return $63($64($65));
var $71 = Effect_Class_Console.error(Effect_Aff.monadEffectAff);
var $72 = Data_Show.show(Core.showMyError);
return function ($73) {
return $71($72($73));
};
})())(fetches.value0))(function () {
return Core.exit(1);
@ -7644,18 +8264,19 @@ var PS = {};
});
});
};
throw new Error("Failed pattern match at Generate (line 244, column 3 - line 252, column 13): " + [ fetches.constructor.name ]);
throw new Error("Failed pattern match at Generate (line 247, column 3 - line 255, column 13): " + [ fetches.constructor.name ]);
});
});
});
};
};
exports["generate"] = generate;
exports["parseSpagoArgs"] = parseSpagoArgs;
})(PS);
(function(exports) {
exports.argv = process.argv;
})(PS["Main"] = PS["Main"] || {});
(function($PS) {
// Generated by purs version 0.13.8
"use strict";
$PS["Main"] = $PS["Main"] || {};
var exports = $PS["Main"];
@ -7714,7 +8335,7 @@ var PS = {};
return Core.exit(1);
});
};
throw new Error("Failed pattern match at Main (line 54, column 3 - line 61, column 13): " + [ nixBuildResult.constructor.name ]);
throw new Error("Failed pattern match at Main (line 56, column 3 - line 63, column 13): " + [ nixBuildResult.constructor.name ]);
})())(function () {
return Control_Bind.bind(Effect_Aff.bindAff)(Core.runCommand({
cmd: installCmd,
@ -7735,21 +8356,24 @@ var PS = {};
return Core.exit(1);
});
};
throw new Error("Failed pattern match at Main (line 63, column 3 - line 72, column 13): " + [ installResult.constructor.name ]);
throw new Error("Failed pattern match at Main (line 65, column 3 - line 74, column 13): " + [ installResult.constructor.name ]);
});
});
});
};
var help = "spago2nix - generate Nix derivations from packages required in a spago project, and allow for installing them and building them.\x0a\x0a Usage: spago2nix (generate | install | build)\x0a\x0aAvailable commands:\x0a generate [n]\x0a Generate a Nix expression of packages from Spago. If n is\x0a given, it will limit the number of packages fetched at once.\x0a install [passthrough args for nix-shell]\x0a Install dependencies from spago-packages.nix in Spago style\x0a build [passthrough args for nix-shell]\x0a Build the project Spago style\x0a build-nix [passthrough args for nix-shell]\x0a Build the project using dependency sources from Nix store\x0a";
var help = "spago2nix - generate Nix derivations from packages required in a spago project, and allow for installing them and building them.\x0a\x0a Usage: spago2nix (generate | install | build)\x0a\x0aAvailable commands:\x0a generate [n] [--] [pass-through spago args]\x0a Generate a Nix expression of packages from Spago. If n is\x0a given, it will limit the number of packages fetched at once.\x0a Pass extra flags to Spago by specifying more after `--`.\x0a install [passthrough args for nix-shell]\x0a Install dependencies from spago-packages.nix in Spago style\x0a build [passthrough args for nix-shell]\x0a Build the project Spago style\x0a build-nix [passthrough args for nix-shell]\x0a Build the project using dependency sources from Nix store\x0a";
var generate = function (extraArgs) {
var parse = function (v) {
if (v instanceof Data_List_Types.Nil) {
return new Data_Maybe.Just(0);
};
if (v instanceof Data_List_Types.Cons && v.value1 instanceof Data_List_Types.Nil) {
if (v instanceof Data_List_Types.Cons && v.value0 === "--") {
return new Data_Maybe.Just(0);
};
if (v instanceof Data_List_Types.Cons) {
return Data_Int.fromString(v.value0);
};
return Data_Maybe.Nothing.value;
throw new Error("Failed pattern match at Main (line 48, column 5 - line 48, column 38): " + [ v.constructor.name ]);
};
var v = parse(extraArgs);
if (v instanceof Data_Maybe.Nothing) {
@ -7760,9 +8384,10 @@ var PS = {};
});
};
if (v instanceof Data_Maybe.Just) {
return Generate.generate(v.value0);
var spagoArgs = Generate.parseSpagoArgs(extraArgs);
return Generate.generate(v.value0)(spagoArgs);
};
throw new Error("Failed pattern match at Main (line 39, column 3 - line 44, column 34): " + [ v.constructor.name ]);
throw new Error("Failed pattern match at Main (line 39, column 3 - line 46, column 36): " + [ v.constructor.name ]);
};
var build = function (buildStyle) {
return function (extraArgs) {
@ -7773,7 +8398,7 @@ var PS = {};
if (buildStyle instanceof NixStyle) {
return "buildFromNixStore";
};
throw new Error("Failed pattern match at Main (line 118, column 22 - line 120, column 38): " + [ buildStyle.constructor.name ]);
throw new Error("Failed pattern match at Main (line 120, column 22 - line 122, column 38): " + [ buildStyle.constructor.name ]);
})();
var buildCmd = ".spago2nix/build" + (function () {
if (buildStyle instanceof SpagoStyle) {
@ -7782,7 +8407,7 @@ var PS = {};
if (buildStyle instanceof NixStyle) {
return "/bin/build-from-store";
};
throw new Error("Failed pattern match at Main (line 115, column 29 - line 117, column 42): " + [ buildStyle.constructor.name ]);
throw new Error("Failed pattern match at Main (line 117, column 29 - line 119, column 42): " + [ buildStyle.constructor.name ]);
})();
return Control_Bind.bind(Effect_Aff.bindAff)(Core.buildScript(Data_List_Types.foldableList)({
attr: buildStyleAttr,
@ -7803,7 +8428,7 @@ var PS = {};
return Core.exit(1);
});
};
throw new Error("Failed pattern match at Main (line 84, column 3 - line 91, column 13): " + [ nixBuildResult.constructor.name ]);
throw new Error("Failed pattern match at Main (line 86, column 3 - line 93, column 13): " + [ nixBuildResult.constructor.name ]);
})())(function () {
return Control_Bind.bind(Effect_Aff.bindAff)(Control_Alt.alt(Effect_Aff.altAff)(Core.runDhallToJSON("(./spago.dhall).sources"))(Control_Applicative.pure(Effect_Aff.applicativeAff)("")))(function (json) {
return Control_Bind.bind(Effect_Aff.bindAff)((function () {
@ -7820,7 +8445,7 @@ var PS = {};
return Control_Applicative.pure(Effect_Aff.applicativeAff)(v.value0);
});
};
throw new Error("Failed pattern match at Main (line 93, column 12 - line 101, column 14): " + [ v.constructor.name ]);
throw new Error("Failed pattern match at Main (line 95, column 12 - line 103, column 14): " + [ v.constructor.name ]);
})())(function (globs) {
return Control_Bind.bind(Effect_Aff.bindAff)(Core.runCommand({
cmd: buildCmd,
@ -7841,7 +8466,7 @@ var PS = {};
return Core.exit(1);
});
};
throw new Error("Failed pattern match at Main (line 103, column 3 - line 112, column 13): " + [ buildResult.constructor.name ]);
throw new Error("Failed pattern match at Main (line 105, column 3 - line 114, column 13): " + [ buildResult.constructor.name ]);
});
});
});