packages feed

keiro-dsl-0.15.0.0: test/conformance-service-package/runtime/src/Proof/WorkspaceProof/Generated/BehaviorSourceMap.hs

-- @generated by keiro-dsl 0.15.0.0 (language keiro-dsl 4) from context workspace-proof behavior source map; do not edit.
module Proof.WorkspaceProof.Generated.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-579df4e5e81f7729" -> Just (BehaviorSourceLocation "domain/alpha.keiro" 15 3)
  "behavior-v1-6ab7fee2c8aa4e1d" -> Just (BehaviorSourceLocation "domain/beta.keiro" 11 3)
  "behavior-v1-72a96c964b44a2b6" -> Just (BehaviorSourceLocation "domain/alpha.keiro" 14 3)
  "behavior-v1-baf43b4c31db955a" -> Just (BehaviorSourceLocation "domain/alpha.keiro" 13 3)
  "behavior-v1-c062ccf5e9b6f5c4" -> Just (BehaviorSourceLocation "domain/alpha.keiro" 6 10)
  _ -> 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