diff options
Diffstat (limited to 'src/Network.hs')
-rw-r--r-- | src/Network.hs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Network.hs b/src/Network.hs index 633db16..5872d13 100644 --- a/src/Network.hs +++ b/src/Network.hs @@ -4,12 +4,14 @@ module Network ( NodeName(..), textNodeName, unpackNodeName, ) where +import Control.Arrow import Control.Concurrent import Data.Text (Text) import Data.Text qualified as T import Process +import Test data Network = Network { netNodes :: MVar [Node] @@ -19,6 +21,7 @@ data Network = Network data Node = Node { nodeName :: NodeName + , nodeIp :: Text , nodeNetwork :: Network , nodeDir :: FilePath } @@ -31,3 +34,13 @@ textNodeName (NodeName name) = name unpackNodeName :: NodeName -> String unpackNodeName (NodeName tname) = T.unpack tname + + +instance ExprType Node where + textExprType _ = T.pack "node" + textExprValue n = T.pack "n:" <> textNodeName (nodeName n) + emptyVarValue = Node (NodeName T.empty) T.empty undefined undefined + + recordMembers = map (first T.pack) + [ ("ip", RecordSelector $ nodeIp) + ] |