Skip to content

Commit

Permalink
Use loose parsing for config
Browse files Browse the repository at this point in the history
  • Loading branch information
isovector committed Feb 28, 2021
1 parent 9c20a3a commit 557432e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plugins/hls-tactics-plugin/src/Ide/Plugin/Tactic/TestTypes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
module Ide.Plugin.Tactic.TestTypes where

import Data.Aeson
import Data.Maybe (fromMaybe)
import qualified Data.Text as T
import Ide.Plugin.Tactic.FeatureSet

Expand Down Expand Up @@ -50,7 +51,9 @@ instance ToJSON Config where

instance FromJSON Config where
parseJSON = withObject "Config" $ \obj -> do
cfg_feature_set <- parseFeatureSet <$> obj .: "features"
cfg_max_use_ctor_actions <- obj .: "max_use_ctor_actions"
cfg_feature_set <-
parseFeatureSet . fromMaybe "" <$> obj .:? "features"
cfg_max_use_ctor_actions <-
fromMaybe 5 <$> obj .:? "max_use_ctor_actions"
pure $ Config{..}

0 comments on commit 557432e

Please sign in to comment.