packages feed

keiro-dsl-0.12.0.0: test/conformance-behavior-complete/Generated/BehaviorComplete/BehaviorSourceMap.hs

-- @generated by keiro-dsl 0.12.0.0 (language keiro-dsl 4) from context behavior-complete behavior source map; do not edit.
module Generated.BehaviorComplete.BehaviorSourceMap
  ( BehaviorSourceLocation (..)
  , behaviorSourceLocation
  , renderBehaviorSourceLocation
  ) where

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

data BehaviorSourceLocation = BehaviorSourceLocation
  { sourceFile :: !FilePath
  , sourceLine :: !Int
  , sourceColumn :: !Int
  }
  deriving stock (Eq, Ord, Show)

behaviorSourceLocation :: Text -> Maybe BehaviorSourceLocation
behaviorSourceLocation key = case key of
  "behavior-v1-0128e858fee6f2b3" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/behavior-complete.keiro" 62 3)
  "behavior-v1-08a2bda57424a16e" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/behavior-complete.keiro" 50 3)
  "behavior-v1-2e1fd6b9580e1a3d" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/behavior-complete.keiro" 21 23)
  "behavior-v1-2f3ebf37a55781db" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/behavior-complete.keiro" 44 3)
  "behavior-v1-43b8fc7fa48595dd" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/behavior-complete.keiro" 21 16)
  "behavior-v1-68e75665b789892c" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/behavior-complete.keiro" 70 3)
  "behavior-v1-76005937ded24bec" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/behavior-complete.keiro" 21 16)
  "behavior-v1-7ea811586a738ee5" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/behavior-complete.keiro" 21 23)
  "behavior-v1-83b0a46823e1a788" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/behavior-complete.keiro" 21 10)
  "behavior-v1-8f79f2e40d8b3bd5" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/behavior-complete.keiro" 21 10)
  "behavior-v1-926739ffb27d20e7" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/behavior-complete.keiro" 21 10)
  "behavior-v1-9c61af3593764622" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/behavior-complete.keiro" 21 23)
  "behavior-v1-ba7053f86d15e1b0" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/behavior-complete.keiro" 21 10)
  "behavior-v1-be8b08a049ab4d8b" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/behavior-complete.keiro" 21 23)
  "behavior-v1-d2fc3eca5c449e84" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/behavior-complete.keiro" 38 3)
  "behavior-v1-db1a553baa3eda84" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/behavior-complete.keiro" 56 3)
  "behavior-v1-ea258e9c47d66aac" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/behavior-complete.keiro" 67 3)
  "behavior-v1-f0fbe3a3ba0b40e8" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/behavior-complete.keiro" 77 3)
  "behavior-v1-f9cae2bf4c0d0562" -> Just (BehaviorSourceLocation "keiro-dsl/test/fixtures/behavior-complete.keiro" 21 23)
  _ -> Nothing

renderBehaviorSourceLocation :: Text -> Text
renderBehaviorSourceLocation key = case behaviorSourceLocation key of
  Just location -> T.pack (sourceFile location) <> ":" <> tshow (sourceLine location) <> ":" <> tshow (sourceColumn location)
  Nothing -> "<internal invariant: missing behavior source for " <> key <> ">"

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