Comments (3)
A shell script (or CLI command?) could be included to generate all the template files and directories needed to create an exercise/concept. The following should be accomplished by the script:.
You point is totally valid and holds for all tracks. We probably want to build this into the configlet
tool at some point.
from haskell.
Here is a very plain implementation. What would you add/change?
#!/bin/sh
echo "Enter exercise name using only alphanumeric characters."
echo -n "In PascalCase for module name: "
read MODULE
echo -n "In kebab-case for directories: "
read STUB
BASEDIR="./exercises/concept/$STUB"
DOCS="$BASEDIR/.docs"
META="$BASEDIR/.meta"
EXEMPLAR="$META/exemplar"
EXEMPLAR_SRC="$EXEMPLAR/src"
SRC="$BASEDIR/src"
TEST="$BASEDIR/test"
mkdir -p -v $DOCS
mkdir -p -v $EXEMPLAR_SRC
mkdir -p -v $SRC
mkdir -p -v $TEST
#stack.yaml
cat <<EOF >$BASEDIR/stack.yaml
resolver: lts-18.14
EOF
#package.yaml
cat <<EOF >$BASEDIR/package.yaml
name: $STUB
version: 1.0.0.0
dependencies:
- base
library:
exposed-modules: $MODULE
source-dirs: src
ghc-options: -Wall
# dependencies:
# - foo # List here the packages you
# - bar # want to use in your solution.
tests:
test:
main: Tests.hs
source-dirs: test
dependencies:
- $STUB
- hspec
EOF
#.docs/hints.md
cat <<EOF >$DOCS/hints.md
# General
- General hint(s).
## 1. Task One
- Hint(s) for task one.
EOF
#.docs/instructions.md
cat <<EOF >$DOCS/instructions.md
# Instructions
<!---
Provide general instruction for the exercise.
Start with a short scenario to motivate the problem.
-->
## 1. Task One
<!---
Describe each task that needs to be accomplished separately.
Often, tasks will align with functions that need to be implemented.
-->
EOF
#.docs/introduction.md
cat <<EOF >$DOCS/introduction.md
# Introduction
<!---
Introduce all concepts necessary to complete de exercise.
Provide similar code examples.
\`\`\`haskell
41+1
-> 42
\`\`\`
-->
EOF
#.meta/config.json
cat <<EOF >$META/config.json
{
"blurb": "TODO",
"icon": "TODO",
"authors": ["TODO"],
"forked_from": ["TODO"],
"files": {
"solution": [
"src/$MODULE.hs",
"package.yaml"
],
"test": [
"test/Tests.hs"
],
"exemplar": [
".meta/exemplar/src/$MODULE.hs"
]
}
}
EOF
#.meta/design.md
cat <<EOF >$META/design.md
# Design
## Learning objectives
- Know how to ...
- Understand how to ...
## Out of scope
- Concept out of scope 1; concept out of scope 2.
## Concepts
- \`example-concept-stub\`
## Prequisites
- \`example-prerequisite-stub\`
EOF
#.meta/exemplar/src/Exemplar.hs
cat <<EOF >$EXEMPLAR_SRC/$STUB.hs
module $MODULE (exposedFunction) where
-- TODO: Create exemplar solution.
-- Use the most basic possible implementation of the concept.
-- E.g. exposedFunction takes and Int and returns a String.
exposedFunction :: Int -> String
exposedFunction n = show n
EOF
#src/StarterFile.hs
cat <<EOF >$SRC/$MODULE.hs
module $MODULE (exposedFunction) where
-- TODO: Create stub solution from the exemplar.
-- E.g. exposedFunction takes and Int and returns a String.
exposedFunction :: Int -> String
exposedFunction n = error "Implement this function"
EOF
#test/Tests.hs
cat <<EOF >$TEST/Tests.hs
import Test.Hspec (it, shouldBe, hspec)
import $MODULE (exposedFunction)
--TODO: Create tests for all possible cases of exposed functions in
-- the exemplar.
EOF
echo
echo "$STUB setup complete"
from haskell.
You might want to also add an entry to the track's config.json
file for the exercise.
from haskell.
Related Issues (20)
- Add a disclaimer about version constraints and Stackage
- [Learning Mode] Discussion: How do we best introduce case-expressions? HOT 5
- [Learning Mode] Discussion: building up to Pattern Matching HOT 26
- Which memoization library to use? HOT 3
- [Learning Mode] make learning track visible HOT 1
- Build error (connection failure, `Cabal file info not found...`) HOT 2
- Continuation of development of Learning Mode? HOT 3
- Intention behind not updating a Queen Attack test HOT 2
- docs: contributing instructions regarding versioning are out of date HOT 2
- Binary Search Tree: add test cases for `bstRight`, `bstLeft` HOT 5
- README: Replace outdated information about hints.md with correct information
- Are hints.md files rendering properly? HOT 1
- Add test to check for eligible boards where queen is on rightmost column in queen attack HOT 3
- Exercise Zipper: instruction is out of date HOT 1
- Building a training set of tags for haskell HOT 21
- exercism cli not installing most recent version of project template HOT 2
- Roman numerals doesn't test for Nothing HOT 1
- Phone Number exercise tests are out of sync with problem-specifications HOT 1
- CI is broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from haskell.