diff options
-rw-r--r-- | src/ImageHoster/Data.hs | 13 | ||||
-rw-r--r-- | stack.yaml | 5 |
2 files changed, 7 insertions, 11 deletions
diff --git a/src/ImageHoster/Data.hs b/src/ImageHoster/Data.hs index 39f14e0..1d67c35 100644 --- a/src/ImageHoster/Data.hs +++ b/src/ImageHoster/Data.hs @@ -11,15 +11,14 @@ module ImageHoster.Data , defaultSettings ) where +import Control.Arrow ((***)) import Data.Aeson import Data.Aeson.Types +import Data.Aeson.KeyMap (toList, fromList) +import Data.Aeson.Key (toString, fromString) import Data.Traversable import GHC.Generics -import qualified Data.HashMap.Strict as HM -import qualified Data.Text as T - - -- | We are dealing with seconds when talking about durations, hence the type -- alias. type Seconds = Integer @@ -65,9 +64,9 @@ instance FromJSON Settings where parseUserDict :: Value -> Parser [(String, String)] parseUserDict = withObject "users" $ \o -> - for (HM.toList o) $ \(user, pw) -> do + for (toList $ o) $ \(user, pw) -> do password <- parseJSON pw - return (T.unpack user, password) + return (toString user, password) instance ToJSON Settings where @@ -78,7 +77,7 @@ instance ToJSON Settings where ] where formatUsers :: [(String, String)] -> Object - formatUsers = HM.fromList . map (\(user, pw) -> (T.pack user, toJSON pw)) + formatUsers = fromList . map (fromString *** toJSON) -- | Return the default settings. @@ -17,7 +17,7 @@ # # resolver: ./custom-snapshot.yaml # resolver: https://example.com/snapshots/2018-01-01.yaml -resolver: lts-15.0 +resolver: lts-19.2 # User packages to be built. # Various formats can be used as shown in the example below. @@ -40,9 +40,6 @@ packages: # commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a # extra-deps: -- /home/daniel/src/multipart -- cgi-3001.5.0.0 -- ginger-0.9.1.0 # Override default flag values for local packages and extra-deps # flags: {} |