summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreliaslfox <>2018-11-02 20:16:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2018-11-02 20:16:00 (GMT)
commit758bcb2e1be97a3c03822fd1360606034a1ab8a6 (patch)
treef6ca10a5ee7e6bdd3d4d4b9b0c9cc544194ddfb9
parent49cd3de06b1aafc0fd3219fc3e06a071e7ce168c (diff)
version 0.1.1.10.1.1.1
-rw-r--r--language-elm.cabal19
-rw-r--r--test/program1.elm46
-rw-r--r--test/spec/case1.txt6
-rw-r--r--test/spec/dec1.txt3
-rw-r--r--test/spec/dec2.txt8
-rw-r--r--test/spec/dec3.txt3
-rw-r--r--test/spec/dec4.txt2
-rw-r--r--test/spec/let1.txt4
-rw-r--r--test/spec/let2.txt5
9 files changed, 91 insertions, 5 deletions
diff --git a/language-elm.cabal b/language-elm.cabal
index c0459c4..773abe9 100644
--- a/language-elm.cabal
+++ b/language-elm.cabal
@@ -2,17 +2,17 @@
--
-- see: https://github.com/sol/hpack
--
--- hash: 051b4a8042d05f18fb64b3714184c09ca9363d68b341ec9be6effdb370eeabe0
+-- hash: 04af5d2caaf43cc7d680a3326b8b2aed05a209f2d5a20cc360ea287ba6346f77
name: language-elm
-version: 0.1.1.0
+version: 0.1.1.1
synopsis: Generate elm code
description: Generate elm code from an ast
category: Web
homepage: https://github.com/eliaslfox/language-elm#readme
bug-reports: https://github.com/eliaslfox/language-elm/issues
author: Elias Lawson-Fox
-maintainer: eliaslfox@gmail.com
+maintainer: me@eliaslfox.com
copyright: 2017 Elias Lawson-Fox
license: BSD3
license-file: LICENSE
@@ -20,6 +20,15 @@ build-type: Simple
cabal-version: >= 1.10
extra-source-files:
README.md
+data-files:
+ test/program1.elm
+ test/spec/case1.txt
+ test/spec/dec1.txt
+ test/spec/dec2.txt
+ test/spec/dec3.txt
+ test/spec/dec4.txt
+ test/spec/let1.txt
+ test/spec/let2.txt
source-repository head
type: git
@@ -41,7 +50,7 @@ library
src
build-depends:
MissingH
- , base >=4.11 && <=4.12
+ , base >=4.11 && <4.12
, mtl
, pretty
, protolude
@@ -59,7 +68,7 @@ test-suite language-elm-test
test
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends:
- base >=4.11 && <=4.12
+ base >=4.11 && <4.12
, hspec
, language-elm
, mtl
diff --git a/test/program1.elm b/test/program1.elm
new file mode 100644
index 0000000..cf700a3
--- /dev/null
+++ b/test/program1.elm
@@ -0,0 +1,46 @@
+module Maybe exposing (Maybe(Just, Nothing), andThen, map, map2, map3, map4, map5, withDefault)
+
+
+type Maybe a
+ = Nothing
+ | Just a
+
+
+withDefault : a -> Maybe a -> a
+withDefault default maybe =
+ case maybe of
+ Just value ->
+ value
+
+ Nothing ->
+ default
+
+
+map : (a -> b) -> Maybe a -> Maybe b
+map f maybe =
+ case maybe of
+ Just value ->
+ Just (f value)
+
+ Nothing ->
+ Nothing
+
+
+map2 : (a -> b -> value) -> Maybe a -> Maybe b -> Maybe value
+map2 func ma mb =
+ case ( ma, mb ) of
+ ( Just a, Just b ) ->
+ Just (func a b)
+
+ _ ->
+ Nothing
+
+
+map3 : (a -> b -> c -> value) -> Maybe a -> Maybe b -> Maybe c -> Maybe value
+map3 func ma mb mc =
+ case ( ma, mb, mc ) of
+ ( Just a, Just b, Just c ) ->
+ Just (func a b c)
+
+ _ ->
+ Nothing
diff --git a/test/spec/case1.txt b/test/spec/case1.txt
new file mode 100644
index 0000000..ae0c5f6
--- /dev/null
+++ b/test/spec/case1.txt
@@ -0,0 +1,6 @@
+case m of
+ Just x ->
+ x
+
+ Nothing ->
+ 0
diff --git a/test/spec/dec1.txt b/test/spec/dec1.txt
new file mode 100644
index 0000000..7dfbc05
--- /dev/null
+++ b/test/spec/dec1.txt
@@ -0,0 +1,3 @@
+add5 : Int -> Int
+add5 x =
+ x + 5
diff --git a/test/spec/dec2.txt b/test/spec/dec2.txt
new file mode 100644
index 0000000..ced6ccd
--- /dev/null
+++ b/test/spec/dec2.txt
@@ -0,0 +1,8 @@
+withDefault : a -> Maybe a -> a
+withDefault default m =
+ case m of
+ Just x ->
+ x
+
+ Nothing ->
+ default
diff --git a/test/spec/dec3.txt b/test/spec/dec3.txt
new file mode 100644
index 0000000..4b933ef
--- /dev/null
+++ b/test/spec/dec3.txt
@@ -0,0 +1,3 @@
+type Maybe a
+ = Nothing
+ | Just a
diff --git a/test/spec/dec4.txt b/test/spec/dec4.txt
new file mode 100644
index 0000000..9abf93d
--- /dev/null
+++ b/test/spec/dec4.txt
@@ -0,0 +1,2 @@
+type alias Model a =
+ Maybe a
diff --git a/test/spec/let1.txt b/test/spec/let1.txt
new file mode 100644
index 0000000..59db4f9
--- /dev/null
+++ b/test/spec/let1.txt
@@ -0,0 +1,4 @@
+let
+ a = 5
+in
+ a
diff --git a/test/spec/let2.txt b/test/spec/let2.txt
new file mode 100644
index 0000000..b4f6f77
--- /dev/null
+++ b/test/spec/let2.txt
@@ -0,0 +1,5 @@
+let
+ a = 5
+ b = 6
+in
+ a + b