git.iko.soy/typeable/derive-api-th
on master help sign in
Support convertMap for ghcjs
commit217f8c8685e38a2eb873c8edefa4eaa56a5d9d6b authorodr <dima.typeable.io> dateWed 11 Sep 2024, 15:14 (2 years ago) parent10446b5
3 files changed+44
default.nix+34 shell.nix+1 src/Derive/API/TH.hs+9
default.nixnew file+34
@@ -0,0 +1,34 @@
1+{ reflex-platform ? ((import <nixpkgs> {}).fetchFromGitHub {
2+ owner = "reflex-frp";
3+ repo = "reflex-platform";
4+ rev = "a4664e3b99f1b89a77ac759501b6bd85e18eac95";
5+ sha256 = "1pjzjhj966rs16f4b80ir9v8d7g7q2aa0i0zs30fny3x0xk1b4ah";
6+ })
7+}:
8+(import reflex-platform { config.allowBroken = true; }).project ({ pkgs, ... }:{
9+ useWarp = true;
10+ withHoogle = false;
11+
12+ packages = {
13+ derive-api-th = ../derive-api-th;
14+ };
15+
16+ tools = _: [
17+ (pkgs.haskell.lib.dontCheck pkgs.haskellPackages.cabal-cargs)
18+ pkgs.inotify-tools
19+ ];
20+
21+ shellToolOverrides = ghc: super: {
22+ closure-compiler = null;
23+ haskell-ide-engine = null;
24+ hdevtools = null;
25+ hlint = null;
26+ stylish-haskell = null;
27+ hoogle = null;
28+ };
29+
30+ shells = {
31+ ghc = ["derive-api-th"];
32+ ghcjs = ["derive-api-th"];
33+ };
34+})
shell.nixnew file+1
@@ -0,0 +1 @@
1+(import ./default.nix { }).shells.ghcjs
src/Derive/API/TH.hs+9
@@ -60,6 +60,15 @@ deriveApiAndArbitraryInstances opts tname =
6060 deriveApiInstances opts tname
6161#endif
6262
63+#if MIN_VERSION_containers(0,6,6)
64+#elif MIN_VERSION_template_haskell(2,16,0)
65+instance (Lift k, Lift a) => Lift (Map k a) where
66+ liftTyped x = unsafeCodeCoerce (lift x)
67+ lift m = [|M.fromList (M.toList m)|]
68+#else
69+instance (Lift k, Lift a) => Lift (Map k a) where
70+ lift m = [|M.fromList (M.toList m)|]
71+#endif
6372-- We can't directly 'lift' Options into TH (there is no instance for function),
6473-- so we use this type.
6574data DerivingOptions = DerivingOptions