packages feed

keiro-dsl-0.26.0.0: test/conformance-topology-machine/Generated/TopologyMachine/BehaviorSourceMap.hs

-- @generated by keiro-dsl 0.26.0.0 (language keiro-dsl 6) from context topology-machine behavior source map; do not edit.
module Generated.TopologyMachine.BehaviorSourceMap
  ( BehaviorSourceLocation (..)
  , behaviorSourceLocation
  , renderBehaviorSourceLocation
  ) where

import Data.Text (Text)
import Data.Text qualified as T

data BehaviorSourceLocation = BehaviorSourceLocation
  { file :: !FilePath
  , line :: !Int
  , column :: !Int
  }
  deriving stock (Eq, Ord, Show)

behaviorSourceLocation :: Text -> Maybe BehaviorSourceLocation
behaviorSourceLocation key = case key of
  "behavior-v1-002dd349c9f95c03" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 11 16)
  "behavior-v1-339bb773d33d1cd9" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 32 3)
  "behavior-v1-364d670a2b00ba7a" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 11 31)
  "behavior-v1-4703c81ac84fd269" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 11 21)
  "behavior-v1-4ad1b28167914e12" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 11 16)
  "behavior-v1-4c06e1818180b41a" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 11 10)
  "behavior-v1-4c3acea05eae1527" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 34 3)
  "behavior-v1-5b1cf802887be9da" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 11 31)
  "behavior-v1-681e78594be5e34d" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 26 3)
  "behavior-v1-6dc85069e4d4aeaf" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 11 31)
  "behavior-v1-820d02611d3fe202" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 11 16)
  "behavior-v1-8592eed35edbc505" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 41 10)
  "behavior-v1-86aedf6e0162577f" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 11 10)
  "behavior-v1-acb73cfddfb6ec54" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 11 31)
  "behavior-v1-b3bf157ed703ffaf" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 11 10)
  "behavior-v1-bba7be6454e48fd5" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 27 3)
  "behavior-v1-c193804300699444" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 11 21)
  "behavior-v1-cd039e17dcc38865" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 11 21)
  "behavior-v1-cf6a23ed42e4970a" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 33 3)
  "behavior-v1-d9f622535671546c" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 51 3)
  "behavior-v1-e07448f38133b7e0" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 28 3)
  "behavior-v1-ec060a2c3596b1c2" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 11 21)
  "behavior-v1-ed926b1ef15794db" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 11 31)
  "behavior-v1-edb42bb9533e3443" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 49 3)
  "behavior-v1-f281427a09b33c8d" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/topology-machine.keiro" 50 3)
  _ -> Nothing

renderBehaviorSourceLocation :: Text -> Text
renderBehaviorSourceLocation key = case behaviorSourceLocation key of
  Just location -> T.pack location.file <> ":" <> tshow location.line <> ":" <> tshow location.column
  Nothing -> "<internal invariant: missing behavior source for " <> key <> ">"

tshow :: Show value => value -> Text
tshow = T.pack . show