Skip to content

Commit 3af722b

Browse files
authored
Haddock (#54)
1 parent 852c6eb commit 3af722b

18 files changed

+696
-401
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ You can install both of these tools with `stack install`:
4242
For a complete lint and format run-through, use these commands. You can, of course, exclude files you haven't modified.
4343

4444
```bash
45-
>> stylish-haskell -i src/*.hs app/Main.hs tests/Main.hs tests/UnitTests.hs
46-
>> hlint src/ app/Main.hs tests/Main.hs tests/UnitTests.hs
45+
>> stylish-haskell -i src/Haskellings/*.hs src/Haskellings/Internal/*.hs app/Main.hs tests/Main.hs tests/UnitTests.hs
46+
>> hlint src/Haskellings/*.hs src/Haskellings/Internal/*.hs app/Main.hs tests/Main.hs tests/UnitTests.hs
4747
```
4848

4949
Running `stylish-haskell -i` will automatically fix issues in place. Linting issues from `hlint` are output to the terminal and must be fixed manually.

app/Main.hs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
module Main where
22

33
import Control.Monad.Reader
4-
import Data.Map (empty)
5-
import Data.Tuple.Extra (uncurry3)
4+
import Data.Map (empty)
5+
import Data.Tuple.Extra (uncurry3)
66
import System.Environment
77
import System.IO
88

9-
import Constants
10-
import LoadConfig
11-
import RunCommands
12-
import TerminalUtils
13-
import Types
14-
import Watcher
9+
import Haskellings.Constants
10+
import Haskellings.LoadConfig
11+
import Haskellings.RunCommands
12+
import Haskellings.TerminalUtils
13+
import Haskellings.Types
14+
import Haskellings.Watcher
1515

1616
main :: IO ()
1717
main = do

haskellings.cabal

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ source-repository head
2121

2222
library
2323
exposed-modules:
24-
Constants
25-
DirectoryUtils
26-
ExerciseList
27-
ExecutableExercises
28-
LoadConfig
29-
Processor
30-
RunCommands
31-
TerminalUtils
32-
Types
33-
Watcher
24+
Haskellings.Constants
25+
Haskellings.DirectoryUtils
26+
Haskellings.LoadConfig
27+
Haskellings.Processor
28+
Haskellings.RunCommands
29+
Haskellings.TerminalUtils
30+
Haskellings.Types
31+
Haskellings.Watcher
3432
other-modules:
3533
Paths_haskellings
34+
Haskellings.Internal.ExerciseList
35+
Haskellings.Internal.ExecutableExercises
3636
hs-source-dirs:
3737
src
3838
build-depends:

src/Constants.hs

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/DirectoryUtils.hs

Lines changed: 0 additions & 106 deletions
This file was deleted.

src/Haskellings/Constants.hs

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{-|
2+
Module : Haskellings.Constants
3+
Description : Constant expressions for Haskellings
4+
License : BSD3
5+
Maintainer : james@mondaymorninghaskell.me
6+
7+
This module has constant values that are used across Haskellings.
8+
It includes things like the string for the GHC version currently in use,
9+
hard-coded directory and file names, and required libraries.
10+
-}
11+
12+
module Haskellings.Constants
13+
( -- * Version strings
14+
-- | Includes the GHC version currently in use, and the Haskellings version.
15+
ghcVersion
16+
, ghcVersionNumber
17+
, haskellingsVersion
18+
-- * Files and directories
19+
-- | These help us locate the exercises and configurations.
20+
, projectRootDirName
21+
, mainProjectExercisesDir
22+
, configFileName
23+
-- * Required Libraries
24+
-- | Haskellings requires these are installed with the Stack package
25+
-- in order to function.
26+
, haskellingsRequiredLibs
27+
-- * CI Constants
28+
-- | These help us to run tests in the Circle CI environment.
29+
, envIsCi
30+
, ciProjectRootDirName
31+
) where
32+
33+
import Data.Maybe
34+
import System.Environment
35+
36+
-- | The GHC version currently used by Haskellings. We use this
37+
-- to locate the appropriate GHC executable.
38+
ghcVersion :: String
39+
ghcVersion = "ghc-8.10.4"
40+
41+
-- | The version number, isolated from any prefix. Also helps in
42+
-- finding certain directories.
43+
ghcVersionNumber :: String
44+
ghcVersionNumber = "8.10.4"
45+
46+
-- | The current Haskellings program version.
47+
haskellingsVersion :: String
48+
haskellingsVersion = "0.8.0.0"
49+
50+
-- | The project root directory name. We need to find the project root
51+
-- in order to locate the exercises.
52+
projectRootDirName :: String
53+
projectRootDirName = "haskellings"
54+
55+
-- | The name of the exercises directory.
56+
mainProjectExercisesDir :: String
57+
mainProjectExercisesDir = "exercises"
58+
59+
-- | The name of the config file, which can store a custom GHC location.
60+
configFileName :: String
61+
configFileName = "config.yaml"
62+
63+
-- | A listing of packages required by exercises, so we can use them
64+
-- to filter Stack snapshots
65+
haskellingsRequiredLibs :: [String]
66+
haskellingsRequiredLibs =
67+
[ "tasty"
68+
, "tasty-hunit"
69+
]
70+
71+
-- | Tells us if we are running in a Circle CI environment. This affects
72+
-- how we construct the path and find the exercises.
73+
envIsCi :: IO Bool
74+
envIsCi = isJust <$> lookupEnv ciEnvName
75+
76+
-- | The project root name when running on Circle CI.
77+
ciProjectRootDirName :: String
78+
ciProjectRootDirName = "project"
79+
80+
---------- PRIVATE FUNCTIONS ----------
81+
82+
-- We set this environment variable on Circle CI.
83+
ciEnvName :: String
84+
ciEnvName = "HASKELLINGS_CI_ENV"

0 commit comments

Comments
 (0)