import CacheSim.Model exposing (..) import CacheSim.Cache exposing (..) import CacheSim.IntMap exposing (..) import CacheSim.Update exposing (..) import CacheSim.Hierarchy exposing (..) import CacheSim.Raw exposing (..) import CacheSim.View exposing (..) import Browser exposing (Document, document) import Html exposing (text) init : Flags -> (Model, Cmd Msg) init f = let initialModel = { rawHierarchy = [] , hierarchy = Nothing , accessView = Nothing , accessInput = "" } in (initialModel, Cmd.none) view : Model -> Document Msg view m = { title = "Cache Simulator" , body = [ viewBase m ] } update : Msg -> Model -> (Model, Cmd Msg) update msg m = case msg of ChangeRawModel l f -> updateChangeRawModel l f m CreateRawModel -> updateCreateRawModel m DeleteRawModel i -> updateDeleteRawModel i m UseHierarchy cmh -> updateUseHierarchy cmh m Access i -> updateAccess i m ChangeAccessInput s -> ({ m | accessInput = s }, Cmd.none) AccessViewCancel -> updateAccessViewCancel m AccessViewForward -> updateAccessViewForward m AccessViewBack -> updateAccessViewBack m subscriptions : Model -> Sub Msg subscriptions m = Sub.none main = document { init = init , view = view , update = update , subscriptions = subscriptions }