git.iko.soy/ikoHSE/sc-task-2
on master help sign in
bump
commit60cc3d6994fd74ecc34ef317eaf1d20977580196 authoriko <mail@iko.soy> dateFri 12 Dec 2025, 10:06 (1 year ago) parent0f050ab
5 files changed+44−17
unifiedsplit
package.yaml+4−1 src/Task.hs+7−7 stack.yaml+18−2 task.cabal+8−4 test/Tests.hs+7−3
package.yaml+4−1
@@ -2,8 +2,11 @@ name: task
22version: 0.1.0.0
33license: Unlicense
44
5+default-extensions:
6+ - DerivingStrategies
7+
58dependencies:
6− - base >= 4.7 && < 5
9+ - base
710
811library:
912 source-dirs: src
src/Task.hs+7−7
@@ -105,11 +105,11 @@ destructLastMonoid = error "TODO: destructLastMonoid"
105105
106106-- | The priority of a task.
107107data Priority = Low | Medium | High
108− deriving (Show, Eq)
108+ deriving stock (Show, Eq)
109109
110110-- | The completion status of a task.
111111data Completion = Completed | NotCompleted
112− deriving (Show, Eq, Ord)
112+ deriving stock (Show, Eq, Ord)
113113
114114class TaskManager t where
115115 -- | Returns an empty task manager backend (it should have no tasks).
@@ -194,7 +194,7 @@ data Coffee
194194 -- | The extra ingredients added to the coffee.
195195 extras :: [CoffeeExtra]
196196 }
197− deriving (Eq, Show)
197+ deriving stock (Eq, Show)
198198
199199-- Extra ingredients added to the coffee.
200200data CoffeeExtra
@@ -205,7 +205,7 @@ data CoffeeExtra
205205 | Cinnamon
206206 | WhiteSugar
207207 | BrownSugar
208− deriving (Eq, Show)
208+ deriving stock (Eq, Show)
209209
210210-- | A typeclass representing objects, for which the price can be calculated.
211211class HasPrice x where
@@ -233,7 +233,7 @@ data DebitCard
233233 { balance :: RUBAmount,
234234 cardId :: Int
235235 }
236− deriving (Eq, Show)
236+ deriving stock (Eq, Show)
237237
238238-- | Given a coffee and a debit card, deduce the total price of the coffee from
239239-- the debit card. Return the given debit card with the reduced balance.
@@ -256,7 +256,7 @@ data PaymentMethod
256256 -- (We assume that the person pays with all of the cash he has.)
257257 change :: RUBAmount
258258 }
259− deriving (Eq, Show)
259+ deriving stock (Eq, Show)
260260
261261-- | Represents a coffee shop customer with all of the money he has on him.
262262data Customer
@@ -268,7 +268,7 @@ data Customer
268268 -- | The amount of cash the customer has on him.
269269 cash :: RUBAmount
270270 }
271− deriving (Eq, Show)
271+ deriving stock (Eq, Show)
272272
273273-- You have some new privacy-invading piece of ... technology, which
274274-- automatically scans the customer, determines how he would prefer to pay and
stack.yaml+18−2
@@ -1,7 +1,23 @@
1−resolver: nightly-2024-10-11
1+resolver: lts-24.23
22
33packages:
44- .
55
66ghc-options:
7− "$locals": -ddump-to-file -ddump-hi -fwarn-unused-binds -fwarn-unused-imports -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Werror=missing-home-modules -Wmissing-home-modules -Widentities -Wredundant-constraints -Wmissing-export-lists
7+ "$locals": |
8+ -Weverything
9+ -Wno-unsafe
10+ -Wno-safe
11+ -Wno-missing-safe-haskell-mode
12+ -Wno-missing-import-lists
13+ -Wno-missing-kind-signatures
14+ -Wno-all-missed-specialisations
15+ -Wno-missed-specialisations
16+ -Wno-partial-type-signatures
17+ -Wno-partial-fields
18+ -Wno-operator-whitespace
19+ -Wno-missed-extra-shared-lib
20+ -Wno-missing-role-annotations
21+ -Wno-missing-poly-kind-signatures
22+ -Wno-implicit-prelude
23+ -threaded
task.cabal+8−4
@@ -1,10 +1,10 @@
11cabal-version: 2.2
22
3−-- This file has been generated from package.yaml by hpack version 0.36.0.
3+-- This file has been generated from package.yaml by hpack version 0.37.0.
44--
55-- see: https://github.com/sol/hpack
66--
7−-- hash: e7ce4d16c67bf724ae661c06d421b31bdf4a8955874528858483b7ed2f59e002
7+-- hash: 657afec45539e088a3bf6470712f3a50870d849db61d3f1c453c5d9d2bd91018
88
99name: task
1010version: 0.1.0.0
@@ -21,8 +21,10 @@ library
2121 Paths_task
2222 hs-source-dirs:
2323 src
24+ default-extensions:
25+ DerivingStrategies
2426 build-depends:
25− base >=4.7 && <5
27+ base
2628 default-language: Haskell2010
2729
2830test-suite task-tests
@@ -35,8 +37,10 @@ test-suite task-tests
3537 Paths_task
3638 hs-source-dirs:
3739 test
40+ default-extensions:
41+ DerivingStrategies
3842 build-depends:
39− base >=4.7 && <5
43+ base
4044 , task
4145 , tasty
4246 , tasty-hunit
test/Tests.hs+7−3
@@ -5,7 +5,7 @@ where
55
66import Data.Foldable
77import Data.Function
8−import Data.List
8+import Data.List (sort, groupBy)
99import Task
1010import Test.Tasty
1111import Test.Tasty.HUnit
@@ -14,7 +14,9 @@ tests :: TestTree
1414tests = testGroup "Tests"
1515 [ testGroup "List Monoids"
1616 [ testCase "FirstMonoid" $ do
17− let getFirst = destructFirstMonoid . fold . fmap constructFirstMonoid
17+ let
18+ getFirst :: [a] -> Maybe a
19+ getFirst = destructFirstMonoid . fold . fmap constructFirstMonoid
1820 getFirst [1 :: Int, 2, 3] @=? Just 1
1921 getFirst [] @=? (Nothing :: Maybe ())
2022 getFirst [True, False] @=? Just True
@@ -23,7 +25,9 @@ tests = testGroup "Tests"
2325 getFirst [100 .. 1000] @=? Just (100 :: Int)
2426 getFirst [6, 2, 7, 398, 1984, 383, -1020] @=? Just (6 :: Int)
2527 , testCase "LastMonoid" $ do
26− let getLast = destructLastMonoid . fold . fmap constructLastMonoid
28+ let
29+ getLast :: [a] -> Maybe a
30+ getLast = destructLastMonoid . fold . fmap constructLastMonoid
2731 getLast [1 :: Int, 2, 3] @=? Just 3
2832 getLast [] @=? (Nothing :: Maybe ())
2933 getLast [1 .. 1000] @=? Just (1000 :: Int)