Skip to content

Commit f74fc9a

Browse files
authored
Merge pull request #47 from waddlaw/T46-reduce-dependencies
hlint, vector, yaml の依存関係削除
2 parents e2765f1 + 2a67f9e commit f74fc9a

File tree

4 files changed

+8
-18
lines changed

4 files changed

+8
-18
lines changed

package.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ library:
4646
- errors
4747
- filepath
4848
- ghc-syntax-highlighter
49-
- hint
5049
# - i18n Use in the future
5150
- open-browser
5251
- QuickCheck
@@ -55,8 +54,6 @@ library:
5554
- text
5655
- transformers
5756
- typed-process
58-
- vector
59-
- yaml
6057
when:
6158
- condition: os(windows)
6259
dependencies:

src/Education/MakeMistakesToLearnHaskell/Exercise/Record.hs

+5-6
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,16 @@ loadLastShownName :: Env -> IO Name
1616
loadLastShownName e = do
1717
path <- prepareRecordFilePath e
1818
exists <- Dir.doesFileExist path
19-
if exists
20-
then
21-
lastShownName <$> (throwWhenLeft =<< Yaml.decodeFileEither path)
22-
else
23-
return "1"
19+
if exists then
20+
fmap (lastShownName . read) $ readFile path
21+
else
22+
return "1"
2423

2524

2625
saveLastShownName :: Env -> Name -> IO ()
2726
saveLastShownName e n = do
2827
path <- prepareRecordFilePath e
29-
Yaml.encodeFile path $ Record n
28+
writeFile path $ show $ Record n
3029

3130

3231
prepareRecordFilePath :: Env -> IO FilePath

src/Education/MakeMistakesToLearnHaskell/Exercise/Types.hs

+3-7
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,9 @@ data Result =
2727
| NotYetImplemented
2828
deriving (Eq, Show)
2929

30-
newtype Record =
31-
Record
32-
{ lastShownName :: Name
33-
} deriving Generic
34-
35-
instance Yaml.FromJSON Record
36-
instance Yaml.ToJSON Record
30+
newtype Record = Record
31+
{ lastShownName :: Name
32+
} deriving (Show, Read)
3733

3834
type Details = Text
3935

src/imports/external.hs

-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ import qualified Data.Text.Lazy.Encoding as TextEncoding
3636
import qualified Data.Text as TextS
3737
import qualified Data.Text.IO as TextS
3838
import Data.Typeable (Typeable)
39-
import qualified Data.Yaml as Yaml
40-
import qualified Data.Yaml.TH as Yaml
4139
import qualified Debug.Trace as Debug
4240
import GHC.Generics (Generic)
4341
import qualified GHC.SyntaxHighlighter as GHC

0 commit comments

Comments
 (0)