Skip to content

Commit d960649

Browse files
committedJul 24, 2024
feat: Added Stack to the project
This allows me to import stuff between chapter directories
1 parent 4f5a926 commit d960649

13 files changed

+287
-5
lines changed
 

‎.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
**/**/*.ts
1+
.stack-work/
2+
*~

‎CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Changelog for `haskell-from-first-principles-exercies`
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to the
7+
[Haskell Package Versioning Policy](https://pvp.haskell.org/).
8+
9+
## Unreleased
10+
11+
## 0.1.0.0 - YYYY-MM-DD

‎LICENSE

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Copyright Author name here (c) 2024
2+
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
11+
* Redistributions in binary form must reproduce the above
12+
copyright notice, this list of conditions and the following
13+
disclaimer in the documentation and/or other materials provided
14+
with the distribution.
15+
16+
* Neither the name of Author name here nor the names of other
17+
contributors may be used to endorse or promote products derived
18+
from this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# Exercises from the "Haskell From First Principles" Book
1+
# haskell-from-first-principles-exercies

‎Setup.hs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import Distribution.Simple
2+
main = defaultMain

‎app/Main.hs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Main (main) where
2+
3+
import Lib
4+
5+
main :: IO ()
6+
main = someFunc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
cabal-version: 2.2
2+
3+
-- This file has been generated from package.yaml by hpack version 0.36.0.
4+
--
5+
-- see: https://github.com/sol/hpack
6+
7+
name: haskell-from-first-principles-exercies
8+
version: 0.1.0.0
9+
description: Please see the README on GitHub at <https://github.com/githubuser/haskell-from-first-principles-exercies#readme>
10+
homepage: https://github.com/githubuser/haskell-from-first-principles-exercies#readme
11+
bug-reports: https://github.com/githubuser/haskell-from-first-principles-exercies/issues
12+
author: Author name here
13+
maintainer: example@example.com
14+
copyright: 2024 Author name here
15+
license: BSD-3-Clause
16+
license-file: LICENSE
17+
build-type: Simple
18+
extra-source-files:
19+
README.md
20+
CHANGELOG.md
21+
22+
source-repository head
23+
type: git
24+
location: https://github.com/githubuser/haskell-from-first-principles-exercies
25+
26+
library
27+
exposed-modules:
28+
Ch11.Cipher
29+
Ch9.Cipher
30+
Lib
31+
hs-source-dirs:
32+
src
33+
default-extensions:
34+
ImportQualifiedPost
35+
LambdaCase
36+
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints
37+
build-depends:
38+
base >=4.7 && <5
39+
default-language: Haskell2010
40+
41+
executable haskell-from-first-principles-exercies-exe
42+
main-is: Main.hs
43+
other-modules:
44+
Paths_haskell_from_first_principles_exercies
45+
autogen-modules:
46+
Paths_haskell_from_first_principles_exercies
47+
hs-source-dirs:
48+
app
49+
default-extensions:
50+
ImportQualifiedPost
51+
LambdaCase
52+
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
53+
build-depends:
54+
base >=4.7 && <5
55+
, haskell-from-first-principles-exercies
56+
default-language: Haskell2010
57+
58+
test-suite haskell-from-first-principles-exercies-test
59+
type: exitcode-stdio-1.0
60+
main-is: Spec.hs
61+
other-modules:
62+
Paths_haskell_from_first_principles_exercies
63+
autogen-modules:
64+
Paths_haskell_from_first_principles_exercies
65+
hs-source-dirs:
66+
test
67+
default-extensions:
68+
ImportQualifiedPost
69+
LambdaCase
70+
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
71+
build-depends:
72+
base >=4.7 && <5
73+
, haskell-from-first-principles-exercies
74+
default-language: Haskell2010

‎package.yaml

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: haskell-from-first-principles-exercies
2+
version: 0.1.0.0
3+
github: "githubuser/haskell-from-first-principles-exercies"
4+
license: BSD-3-Clause
5+
author: "Author name here"
6+
maintainer: "example@example.com"
7+
copyright: "2024 Author name here"
8+
9+
extra-source-files:
10+
- README.md
11+
- CHANGELOG.md
12+
13+
# Metadata used when publishing your package
14+
# synopsis: Short description of your package
15+
# category: Web
16+
17+
# To avoid duplicated efforts in documentation and dealing with the
18+
# complications of embedding Haddock markup inside cabal files, it is
19+
# common to point users to the README.md file.
20+
description: Please see the README on GitHub at <https://github.com/githubuser/haskell-from-first-principles-exercies#readme>
21+
22+
dependencies:
23+
- base >= 4.7 && < 5
24+
25+
default-extensions:
26+
- ImportQualifiedPost
27+
- LambdaCase
28+
29+
ghc-options:
30+
- -Wall
31+
- -Wcompat
32+
- -Widentities
33+
- -Wincomplete-record-updates
34+
- -Wincomplete-uni-patterns
35+
# - -Wmissing-export-lists
36+
- -Wmissing-home-modules
37+
- -Wpartial-fields
38+
- -Wredundant-constraints
39+
40+
library:
41+
source-dirs: src
42+
43+
exposed-modules:
44+
- Ch11.Cipher
45+
- Ch9.Cipher
46+
- Lib
47+
48+
other-modules: []
49+
50+
executables:
51+
haskell-from-first-principles-exercies-exe:
52+
main: Main.hs
53+
source-dirs: app
54+
ghc-options:
55+
- -threaded
56+
- -rtsopts
57+
- -with-rtsopts=-N
58+
dependencies:
59+
- haskell-from-first-principles-exercies
60+
61+
tests:
62+
haskell-from-first-principles-exercies-test:
63+
main: Spec.hs
64+
source-dirs: test
65+
ghc-options:
66+
- -threaded
67+
- -rtsopts
68+
- -with-rtsopts=-N
69+
dependencies:
70+
- haskell-from-first-principles-exercies

‎src/Ch11/Playground.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ instance TooMany GoatField where
7373
tooMany :: GoatField -> Bool
7474
tooMany (GoatField (Goats n1, Goats n2)) = tooMany (n1 + n2)
7575

76-
instance (Num a, TooMany a) => TooMany (a, a) where
77-
tooMany :: (a, a) -> Bool
78-
tooMany (n, n2) = tooMany (n + n2)
76+
-- instance (Num a, TooMany a) => TooMany (a, a) where
77+
-- tooMany :: (a, a) -> Bool
78+
-- tooMany (n, n2) = tooMany (n + n2)
7979

8080
data Gardenia = Gardenia deriving (Show)
8181
data Daisy = Daisy deriving (Show)

‎src/Lib.hs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Lib
2+
( someFunc
3+
) where
4+
5+
someFunc :: IO ()
6+
someFunc = putStrLn "someFunc"

‎stack.yaml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# This file was automatically generated by 'stack init'
2+
#
3+
# Some commonly used options have been documented as comments in this file.
4+
# For advanced use and comprehensive documentation of the format, please see:
5+
# https://docs.haskellstack.org/en/stable/yaml_configuration/
6+
7+
# Resolver to choose a 'specific' stackage snapshot or a compiler version.
8+
# A snapshot resolver dictates the compiler version and the set of packages
9+
# to be used for project dependencies. For example:
10+
#
11+
# resolver: lts-21.13
12+
# resolver: nightly-2023-09-24
13+
# resolver: ghc-9.6.2
14+
#
15+
# The location of a snapshot can be provided as a file or url. Stack assumes
16+
# a snapshot provided as a file might change, whereas a url resource does not.
17+
#
18+
# resolver: ./custom-snapshot.yaml
19+
# resolver: https://example.com/snapshots/2023-01-01.yaml
20+
resolver:
21+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/11.yaml
22+
23+
# User packages to be built.
24+
# Various formats can be used as shown in the example below.
25+
#
26+
# packages:
27+
# - some-directory
28+
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
29+
# subdirs:
30+
# - auto-update
31+
# - wai
32+
packages:
33+
- .
34+
# Dependency packages to be pulled from upstream that are not in the resolver.
35+
# These entries can reference officially published versions as well as
36+
# forks / in-progress versions pinned to a git hash. For example:
37+
#
38+
# extra-deps:
39+
# - acme-missiles-0.3
40+
# - git: https://github.com/commercialhaskell/stack.git
41+
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
42+
#
43+
# extra-deps: []
44+
45+
# Override default flag values for local packages and extra-deps
46+
# flags: {}
47+
48+
# Extra package databases containing global packages
49+
# extra-package-dbs: []
50+
51+
# Control whether we use the GHC we find on the path
52+
# system-ghc: true
53+
#
54+
# Require a specific version of Stack, using version ranges
55+
# require-stack-version: -any # Default
56+
# require-stack-version: ">=2.13"
57+
#
58+
# Override the architecture used by Stack, especially useful on Windows
59+
# arch: i386
60+
# arch: x86_64
61+
#
62+
# Extra directories used by Stack for building
63+
# extra-include-dirs: [/path/to/dir]
64+
# extra-lib-dirs: [/path/to/dir]
65+
#
66+
# Allow a newer minor version of GHC than the snapshot specifies
67+
# compiler-check: newer-minor

‎stack.yaml.lock

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# This file was autogenerated by Stack.
2+
# You should not edit this file by hand.
3+
# For more information, please see the documentation at:
4+
# https://docs.haskellstack.org/en/stable/lock_files
5+
6+
packages: []
7+
snapshots:
8+
- completed:
9+
sha256: 2fdd7d3e54540062ef75ca0a73ca3a804c527dbf8a4cadafabf340e66ac4af40
10+
size: 712469
11+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/11.yaml
12+
original:
13+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/11.yaml

‎test/Spec.hs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
main :: IO ()
2+
main = putStrLn "Test suite not yet implemented"

0 commit comments

Comments
 (0)
Please sign in to comment.