File tree 4 files changed +8
-18
lines changed
Education/MakeMistakesToLearnHaskell/Exercise
4 files changed +8
-18
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,6 @@ library:
46
46
- errors
47
47
- filepath
48
48
- ghc-syntax-highlighter
49
- - hint
50
49
# - i18n Use in the future
51
50
- open-browser
52
51
- QuickCheck
@@ -55,8 +54,6 @@ library:
55
54
- text
56
55
- transformers
57
56
- typed-process
58
- - vector
59
- - yaml
60
57
when :
61
58
- condition : os(windows)
62
59
dependencies :
Original file line number Diff line number Diff line change @@ -16,17 +16,16 @@ loadLastShownName :: Env -> IO Name
16
16
loadLastShownName e = do
17
17
path <- prepareRecordFilePath e
18
18
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"
24
23
25
24
26
25
saveLastShownName :: Env -> Name -> IO ()
27
26
saveLastShownName e n = do
28
27
path <- prepareRecordFilePath e
29
- Yaml. encodeFile path $ Record n
28
+ writeFile path $ show $ Record n
30
29
31
30
32
31
prepareRecordFilePath :: Env -> IO FilePath
Original file line number Diff line number Diff line change @@ -27,13 +27,9 @@ data Result =
27
27
| NotYetImplemented
28
28
deriving (Eq , Show )
29
29
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 )
37
33
38
34
type Details = Text
39
35
Original file line number Diff line number Diff line change @@ -36,8 +36,6 @@ import qualified Data.Text.Lazy.Encoding as TextEncoding
36
36
import qualified Data.Text as TextS
37
37
import qualified Data.Text.IO as TextS
38
38
import Data.Typeable (Typeable )
39
- import qualified Data.Yaml as Yaml
40
- import qualified Data.Yaml.TH as Yaml
41
39
import qualified Debug.Trace as Debug
42
40
import GHC.Generics (Generic )
43
41
import qualified GHC.SyntaxHighlighter as GHC
You can’t perform that action at this time.
0 commit comments