Commit ca9e6e9a authored by Alexandre Delanoë's avatar Alexandre Delanoë

[STYLE] Better use of Lenses.

parent 55bf4c4d
......@@ -57,7 +57,7 @@ class ReadFile a where
saveFile :: (MonadReader env m, MonadIO m, HasSettings env, SaveFile a)
=> a -> m FilePath
saveFile a = do
dataPath <- _fileFolder . (view settings) <$> ask
dataPath <- view (settings . fileFolder) <$> ask
(fp,fn) <- liftIO $ (toPath 3) . hash . Text.pack . show <$> newStdGen
let foldPath = dataPath <> "/" <> fp
......@@ -72,5 +72,5 @@ saveFile a = do
readFile :: (MonadReader env m, MonadIO m, HasSettings env, ReadFile a)
=> FilePath -> m a
readFile fp = do
dataPath <- _fileFolder . (view settings) <$> ask
dataPath <- view (settings . fileFolder) <$> ask
liftIO $ readFile' $ dataPath <> "/" <> fp
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment