Skip to content

Instantly share code, notes, and snippets.

@allansideas
Created July 9, 2017 09:08
Show Gist options
  • Save allansideas/4e206abab9b158c6eb03c0714d5aa277 to your computer and use it in GitHub Desktop.
Save allansideas/4e206abab9b158c6eb03c0714d5aa277 to your computer and use it in GitHub Desktop.
Circular dependency troubles
module Msg exposing (..)
import Types exposing (StoryNode, Transition)
type Msg
= NoOp
| Start
| TestStory
| NewStoryNode StoryNode
| TransitionStoryNode Transition
module Types exposing (..)
import Html exposing (Html)
import Msg exposing (..)
type alias StoryNode =
{ id : Int
, nodeType : NodeType
, nodeContent : StoryNodeContent
, state : Maybe String
, transitions : List Transition
}
type NodeType
= NewsNode
| ChatNode
type StoryNodeContent
= NewsItemContent NewsItem
| ChatMessageContent ChatMessage
type alias NewsItem =
{ id : Int
, content : List (Html Msg)
}
type alias ChatMessage =
{ id : Int
, chatId : Int
, userId : Int
, content : List (Html Msg)
}
type alias Player =
{ visitedStoryNodes : List StoryNode
, currentStoryNode : Maybe StoryNode
}
type alias Transition =
{ transitionType : String, toStoryNode : Int, text : Maybe String }
type alias Model =
{ player : Player
, nodes : List StoryNode
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment