Skip to content

Commit

Permalink
Merge pull request #475 from ErikSchierboom/hello-world
Browse files Browse the repository at this point in the history
Add hello-world exercise
  • Loading branch information
rbasso authored Feb 20, 2017
2 parents b2c87d7 + c81a40b commit 829a8d1
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 0 deletions.
6 changes: 6 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
"repository": "https://github.com/exercism/xhaskell",
"active": true,
"exercises": [
{
"slug": "hello-world",
"difficulty": 1,
"topics": [
]
},
{
"slug": "leap",
"difficulty": 1,
Expand Down
6 changes: 6 additions & 0 deletions exercises/hello-world/HINTS.md
Original file line number Diff line number Diff line change
@@ -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.
16 changes: 16 additions & 0 deletions exercises/hello-world/examples/success-standard/package.yaml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module HelloWorld (hello) where

hello :: String
hello = "Hello, World!"
19 changes: 19 additions & 0 deletions exercises/hello-world/package.yaml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions exercises/hello-world/src/HelloWorld.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module HelloWorld (hello) where

hello :: String
hello = error "You need to implement this function."
1 change: 1 addition & 0 deletions exercises/hello-world/stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
resolver: lts-7.16
13 changes: 13 additions & 0 deletions exercises/hello-world/test/Tests.hs
Original file line number Diff line number Diff line change
@@ -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!"

0 comments on commit 829a8d1

Please sign in to comment.