never executed always true always false
    1 module Conjure.UI.VarSymBreaking ( outputVarSymBreaking ) where
    2 
    3 import Conjure.Prelude
    4 import Conjure.Language.Definition
    5 import Conjure.Language.AdHoc
    6 import Conjure.Language.Pretty
    7 
    8 import qualified Data.Aeson as JSON             -- aeson
    9 import qualified Data.Aeson.KeyMap as KM
   10 
   11 import qualified Data.Vector as V               -- vector
   12 
   13 
   14 outputVarSymBreaking :: MonadIO m => FilePath -> Model -> m ()
   15 outputVarSymBreaking jsonPath = liftIO . writeFile jsonPath . renderNormal . varSymBreaking
   16 
   17 varSymBreaking :: Model -> JSON.Value
   18 varSymBreaking model = JSON.Object $ KM.fromList
   19     [ ("nodes_to_swap", JSON.Array $ V.fromList $ map JSON.String $ sortNub
   20             $  [ n | Reference (Name n) _ <- universeBi model ]
   21             ++ [ n | Single    (Name n)   <- universeBi model ]
   22             )
   23     , ("model", varSymBreakingDescription model)
   24     ]