summary refs log tree commit diff
path: root/gnu/packages/patches/elm-compiler-fix-map-key.patch
diff options
context:
space:
mode:
authorRobert Vollmert <rob@vllmrt.net>2019-07-15 15:47:14 +0200
committerLudovic Courtès <ludo@gnu.org>2019-08-17 16:23:06 +0200
commitc902458863d1d341ffd74970b75e69c2bb848183 (patch)
tree3e1be743977b793ab705a1b38ab3cd3ed2fa5ad9 /gnu/packages/patches/elm-compiler-fix-map-key.patch
parent198f560fcdf4f05b83b565acfd632153fb09bbf0 (diff)
downloadguix-c902458863d1d341ffd74970b75e69c2bb848183.tar.gz
gnu: Add elm-compiler 0.19.0
This adds the elm compiler, version 0.19.0. This provides the
`elm` command, with the exception of the `elm reactor` subcommand.

Named `elm-compiler`, to leave space for `elm` as the full elm
including reactor.

* gnu/packages/elm.scm: New module.
(elm-compiler): New package.
* gnu/packages/patches/elm-disable-reactor.patch: New patch.
* gnu/packages/patches/elm-fix-map-key.patch: New patch.
* gnu/packages/patches/elm-relax-glsl-bound.patch: New patch.
* gnu/local.mk: Add new files.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/packages/patches/elm-compiler-fix-map-key.patch')
-rw-r--r--gnu/packages/patches/elm-compiler-fix-map-key.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/gnu/packages/patches/elm-compiler-fix-map-key.patch b/gnu/packages/patches/elm-compiler-fix-map-key.patch
new file mode 100644
index 0000000000..4f05ded530
--- /dev/null
+++ b/gnu/packages/patches/elm-compiler-fix-map-key.patch
@@ -0,0 +1,38 @@
+commit e3512d887df41a8162c3e361171c04beca08415b
+Author: Tom Stejskal <tom.stejskal@gmail.com>
+Date:   Mon Nov 19 20:09:43 2018 +0100
+
+    Fix Map.!: given key is not an element in the map
+
+diff --git a/compiler/src/Elm/Compiler/Type/Extract.hs b/compiler/src/Elm/Compiler/Type/Extract.hs
+index 1aafe1d4..99763392 100644
+--- a/compiler/src/Elm/Compiler/Type/Extract.hs
++++ b/compiler/src/Elm/Compiler/Type/Extract.hs
+@@ -10,6 +10,7 @@ module Elm.Compiler.Type.Extract
+ 
+ 
+ import Data.Map ((!))
++import qualified Data.Map as Map
+ import qualified Data.Maybe as Maybe
+ import qualified Data.Set as Set
+ 
+@@ -134,11 +135,15 @@ extractUnion interfaces (Opt.Global home name) =
+     else
+       let
+         pname = toPublicName home name
+-        unions = I._unions (interfaces ! home)
++        maybeUnions = I._unions <$> Map.lookup home interfaces
+       in
+-      case I.toUnionInternals (unions ! name) of
+-        Can.Union vars ctors _ _ ->
+-          T.Union pname vars <$> traverse extractCtor ctors
++      case Map.lookup name =<< maybeUnions of
++        Just union ->
++          case I.toUnionInternals union of
++            Can.Union vars ctors _ _ ->
++              T.Union pname vars <$> traverse extractCtor ctors
++        Nothing ->
++          return $ T.Union pname [] []
+ 
+ 
+ extractCtor :: Can.Ctor -> Extractor (N.Name, [T.Type])