diff --git a/config.json b/config.json index 6e537115c..3d0f680f6 100644 --- a/config.json +++ b/config.json @@ -4,6 +4,12 @@ "repository": "https://github.com/exercism/xhaskell", "active": true, "exercises": [ + { + "slug": "hello-world", + "difficulty": 1, + "topics": [ + ] + }, { "slug": "leap", "difficulty": 1, diff --git a/exercises/hello-world/HINTS.md b/exercises/hello-world/HINTS.md new file mode 100644 index 000000000..1327a8116 --- /dev/null +++ b/exercises/hello-world/HINTS.md @@ -0,0 +1,6 @@ +## Hints + +To complete this exercise, you need to implement the `hello` function. + +You will find the type signature for `hello` already in place, +but it is up to you to define the function. diff --git a/exercises/hello-world/examples/success-standard/package.yaml b/exercises/hello-world/examples/success-standard/package.yaml new file mode 100644 index 000000000..7e8f1598e --- /dev/null +++ b/exercises/hello-world/examples/success-standard/package.yaml @@ -0,0 +1,16 @@ +name: hello-world + +dependencies: + - base + +library: + exposed-modules: HelloWorld + source-dirs: src + +tests: + test: + main: Tests.hs + source-dirs: test + dependencies: + - hello-world + - hspec diff --git a/exercises/hello-world/examples/success-standard/src/HelloWorld.hs b/exercises/hello-world/examples/success-standard/src/HelloWorld.hs new file mode 100644 index 000000000..262815301 --- /dev/null +++ b/exercises/hello-world/examples/success-standard/src/HelloWorld.hs @@ -0,0 +1,4 @@ +module HelloWorld (hello) where + +hello :: String +hello = "Hello, World!" \ No newline at end of file diff --git a/exercises/hello-world/package.yaml b/exercises/hello-world/package.yaml new file mode 100644 index 000000000..356c33391 --- /dev/null +++ b/exercises/hello-world/package.yaml @@ -0,0 +1,19 @@ +name: hello-world + +dependencies: + - base + +library: + exposed-modules: HelloWorld + source-dirs: src + dependencies: + # - foo # List here the packages you + # - bar # want to use in your solution. + +tests: + test: + main: Tests.hs + source-dirs: test + dependencies: + - hello-world + - hspec diff --git a/exercises/hello-world/src/HelloWorld.hs b/exercises/hello-world/src/HelloWorld.hs new file mode 100644 index 000000000..c57424782 --- /dev/null +++ b/exercises/hello-world/src/HelloWorld.hs @@ -0,0 +1,4 @@ +module HelloWorld (hello) where + +hello :: String +hello = error "You need to implement this function." diff --git a/exercises/hello-world/stack.yaml b/exercises/hello-world/stack.yaml new file mode 100644 index 000000000..2306ce727 --- /dev/null +++ b/exercises/hello-world/stack.yaml @@ -0,0 +1 @@ +resolver: lts-7.16 diff --git a/exercises/hello-world/test/Tests.hs b/exercises/hello-world/test/Tests.hs new file mode 100644 index 000000000..422d785ce --- /dev/null +++ b/exercises/hello-world/test/Tests.hs @@ -0,0 +1,13 @@ +import Test.Hspec (Spec, describe, it, shouldBe) +import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith) + +import HelloWorld (hello) + +main :: IO () +main = hspecWith defaultConfig {configFastFail = True} specs + +specs :: Spec +specs = describe "hello-world" $ + + it "hello" $ + hello `shouldBe` "Hello, World!"