Skip to content
This repository has been archived by the owner on Aug 23, 2018. It is now read-only.

Commit

Permalink
Upgrade to 0.16 (paired with @evancz)
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Feldman committed Oct 9, 2015
1 parent 106f76e commit 6a7b6f9
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 75 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
path = elm-websockets
url = [email protected]:vilterp/elm-websockets.git

[submodule "elm-font-awesome"]
path = elm-font-awesome
url = [email protected]:rtfeldman/elm-font-awesome.git
3 changes: 1 addition & 2 deletions backend/Compile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{-# LANGUAGE OverloadedStrings #-}
module Compile (toHtml, toJson) where

import Control.Applicative ((<$>),(<*>))
import Control.Monad (when)
import qualified Data.Text as Text
import qualified Text.Blaze as Blaze
Expand All @@ -19,7 +18,7 @@ import qualified Elm.Utils as Utils

compile :: FilePath -> IO (Either String String)
compile filePath =
do result <- Utils.unwrappedRun "elm-make" [ "--yes", filePath ]
do result <- Utils.unwrappedRun "elm-make" [ "--yes", filePath, "--output=elm.js" ]
case result of
Left (Utils.MissingExe msg) ->
return (Left msg)
Expand Down
7 changes: 3 additions & 4 deletions backend/Generate/Index.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ import qualified Data.List as List
import qualified Data.Map as Map
import qualified Data.Text as Text
import qualified Data.Text.IO as Text
import qualified Elm.Package as Pkg
import qualified Elm.Package.Description as Desc
import qualified Elm.Package.Name as N
import qualified Elm.Package.Paths as Paths
import qualified Elm.Package.Solution as S
import qualified Elm.Package.Version as V
import System.Directory (doesDirectoryExist, doesFileExist, getDirectoryContents)
import System.FilePath ((</>), splitDirectories, takeExtension)

Expand All @@ -35,10 +34,10 @@ data Info = Info


data PackageInfo = PackageInfo
{ _version :: V.Version
{ _version :: Pkg.Version
, _repository :: String
, _summary :: String
, _dependencies :: [(N.Name, V.Version)]
, _dependencies :: [(Pkg.Name, Pkg.Version)]
}


Expand Down
14 changes: 6 additions & 8 deletions backend/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@
{-# LANGUAGE OverloadedStrings #-}
module Main where

import Control.Applicative ((<$>),(<|>))
import Control.Applicative ((<|>))
import Control.Monad (guard)
import Control.Monad.Trans (MonadIO(liftIO))
import qualified Data.List as List
import Data.Maybe (isJust)
import qualified Data.ByteString.Char8 as BSC
import qualified Data.List as List
import qualified Data.Version as Version
import qualified Elm.Compiler as Compiler
import qualified Elm.Package as Pkg
import Elm.Utils ((|>))
import qualified Network.WebSockets.Snap as WSS
import Paths_elm_reactor (version)
import System.Console.CmdArgs
import System.Directory
import System.FilePath
Expand Down Expand Up @@ -56,7 +55,7 @@ flags = Flags
]
&= versionArg
[ explicit, name "version", name "v"
, summary (Version.showVersion version)
, summary (Pkg.versionToString Compiler.version)
]
&= summary startupMessage

Expand Down Expand Up @@ -85,8 +84,7 @@ main =

startupMessage :: String
startupMessage =
"Elm Reactor " ++ Version.showVersion version
++ " (Elm Platform " ++ Compiler.version ++ ")"
"elm reactor " ++ Pkg.versionToString Compiler.version


directoryConfig :: MonadSnap m => DirectoryConfig m
Expand Down Expand Up @@ -178,4 +176,4 @@ staticAssets =


(==>) :: a -> b -> (a,b)
(==>) = (,)
(==>) = (,)
1 change: 1 addition & 0 deletions elm-font-awesome
Submodule elm-font-awesome added at f1ad50
11 changes: 6 additions & 5 deletions elm-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@
"source-directories": [
"frontend",
"elm-html-file",
"elm-font-awesome/src",
"elm-websockets"
],
"exposed-modules": [],
"native-modules": true,
"dependencies": {
"elm-lang/core": "2.0.0 <= v < 3.0.0",
"elm-lang/core": "3.0.0 <= v < 4.0.0",
"evancz/start-app": "2.0.0 <= v < 3.0.0",
"evancz/elm-effects": "1.0.0 <= v < 2.0.0",
"evancz/elm-effects": "2.0.0 <= v < 3.0.0",
"evancz/elm-html": "4.0.0 <= v < 5.0.0",
"evancz/elm-markdown": "1.1.4 <= v < 2.0.0",
"jystic/elm-font-awesome": "1.0.0 <= v < 2.0.0"
"evancz/elm-svg": "2.0.0 <= v < 3.0.0",
"evancz/elm-markdown": "2.0.0 <= v < 3.0.0"
},
"elm-version": "0.15.0 <= v < 0.16.0"
"elm-version": "0.16.0 <= v < 0.17.0"
}
8 changes: 3 additions & 5 deletions elm-reactor.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: elm-reactor
Version: 0.3.2
Version: 0.16


Synopsis:
Expand Down Expand Up @@ -64,14 +64,13 @@ Executable elm-reactor
blaze-markup,
bytestring,
cmdargs,
containers >= 0.3,
containers,
directory >= 1.2,
elm-compiler >= 0.15.1 && < 0.16,
elm-compiler >= 0.16 && < 0.17,
elm-package,
file-embed,
filepath,
fsnotify >= 0.2,
HTTP,
mtl,
process,
snap-core,
Expand All @@ -80,6 +79,5 @@ Executable elm-reactor
text,
time,
transformers,
unordered-containers,
websockets >= 0.9 && < 0.10,
websockets-snap >= 0.8.2.1
38 changes: 19 additions & 19 deletions frontend/Debugger.elm
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ view addr state =
Just activeState ->
div
[ style
[ "display" => "flex"
[ "display" => "flex"
, "flex-direction" => "row"
]
]
Expand Down Expand Up @@ -266,17 +266,17 @@ exportImport addr =
update : Message -> Model -> (Model, Effects Message)
update msg state =
case msg of
SidebarVisible visible ->
( { state | sidebarVisible <- visible }
SidebarVisible visible ->
( { state | sidebarVisible = visible }
, none
)

PermitSwaps permit ->
( { state | permitSwaps <- permit }
PermitSwaps permit ->
( { state | permitSwaps = permit }
, none
)

NewServiceState serviceState ->
NewServiceState serviceState ->
let
logMsg =
case serviceState of
Expand All @@ -290,8 +290,8 @@ update msg state =
Logs.NoOp
in
( { state
| serviceState <- serviceState
, logsState <- fst (Logs.update logMsg state.logsState)
| serviceState = serviceState
, logsState = fst (Logs.update logMsg state.logsState)
}
, Effects.none
)
Expand All @@ -311,7 +311,7 @@ update msg state =
Nothing ->
none
in
( { state | playPauseButtonState <- newState }
( { state | playPauseButtonState = newState }
, sendEffects
)

Expand All @@ -330,7 +330,7 @@ update msg state =
Nothing ->
none
in
( { state | restartButtonState <- newState }
( { state | restartButtonState = newState }
, sendEffects
)

Expand All @@ -351,7 +351,7 @@ update msg state =
Nothing ->
none
in
( { state | logsState <- newLogsState }
( { state | logsState = newLogsState }
, sendEffect
)

Expand All @@ -369,15 +369,15 @@ update msg state =
)

ConnectSocket maybeSocket ->
( { state | swapSocket <- maybeSocket }
( { state | swapSocket = maybeSocket }
, none
)

SwapEvent swapEvt ->
if state.permitSwaps then
case swapEvt of
NewModuleEvent compiledMod ->
( { state | errorState <- NoErrors }
( { state | errorState = NoErrors }
, Signal.send
(Service.commandsMailbox ()).address
(Active.Swap compiledMod)
Expand All @@ -386,13 +386,13 @@ update msg state =
)

CompilationErrorsEvent errs ->
( { state | errorState <- CompilationErrors errs }
( { state | errorState = CompilationErrors errs }
, none
)
else
( state, none )

ServiceCommand serviceCmd ->
ServiceCommand serviceCmd ->
( state
, Signal.send (Service.commandsMailbox ()).address serviceCmd
|> Task.map (always NoOp)
Expand Down Expand Up @@ -449,7 +449,7 @@ update msg state =
( state, sendTask |> task )

SessionInputErrorMessage error ->
( { state | errorState <- SessionInputError error }, none )
( { state | errorState = SessionInputError error }, none )

CommandResponse responseMsg ->
let
Expand All @@ -470,12 +470,12 @@ update msg state =
Active.NoOpResponse ->
state.errorState
in
( { state | errorState <- newErrorState }, none )
( { state | errorState = newErrorState }, none )

CloseErrors ->
( { state | errorState <- NoErrors }, none )
( { state | errorState = NoErrors }, none )

NoOp ->
NoOp ->
( state, none )


Expand Down
43 changes: 23 additions & 20 deletions frontend/Debugger/Active.elm
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,13 @@ update msg state =
case msg of
Command cmd ->
case cmd of
NoOpCommand ->
( state, none )

Play ->
case state.runningState of
Paused pausedIdx record ->
( { state | runningState <- Playing }
( { state | runningState = Playing }
, playFrom state.window_ state.session record pausedIdx
|> task
)
Expand Down Expand Up @@ -161,7 +164,7 @@ update msg state =
|> fst
|> Task.succeed
in
( { state | runningState <- Playing }
( { state | runningState = Playing }
, getRecord
`Task.andThen` (\record ->
playFrom state.window_ state.session record 0)
Expand Down Expand Up @@ -285,7 +288,7 @@ update msg state =
)
)
in
( { state | runningState <- Playing }
( { state | runningState = Playing }
, initTask |> task
)

Expand Down Expand Up @@ -319,9 +322,9 @@ update msg state =
(\id -> id /= mainNodeId)
in
( { state
| numFrames <- state.numFrames + 1
, exprLogs <- newExprLogs
, nodeLogs <- newNodeLogs
| numFrames = state.numFrames + 1
, exprLogs = newExprLogs
, nodeLogs = newNodeLogs
}
, none
)
Expand All @@ -332,18 +335,18 @@ update msg state =
Response resp ->
case resp of
ScrubResponse frameIdx record mainVal ->
( { state | runningState <- Paused frameIdx record }
( { state | runningState = Paused frameIdx record }
, API.renderMain state.session mainVal
|> Task.map (always NoOp)
|> task
)

ForkResponse newSession frameIdx mainVal ->
( { state
| session <- newSession
, numFrames <- frameIdx + 1
, exprLogs <- truncateLogs frameIdx state.exprLogs
, nodeLogs <- truncateLogs frameIdx state.nodeLogs
| session = newSession
, numFrames = frameIdx + 1
, exprLogs = truncateLogs frameIdx state.exprLogs
, nodeLogs = truncateLogs frameIdx state.nodeLogs
}
, API.renderMain state.session mainVal
|> Task.map (always NoOp)
Expand All @@ -352,9 +355,9 @@ update msg state =

SwapResponse newSession mainVal logs newRunningState ->
( { state
| session <- newSession
, runningState <- newRunningState
, exprLogs <- Dict.fromList logs
| session = newSession
, runningState = newRunningState
, exprLogs = Dict.fromList logs
}
, API.renderMain state.session mainVal
|> Task.map (always NoOp)
Expand All @@ -367,11 +370,11 @@ update msg state =
(API.getSgShape newSession).mainId
in
( { state
| session <- newSession
, numFrames <- numFrames
, exprLogs <- Dict.fromList exprLogs
, runningState <- Playing
, nodeLogs <-
| session = newSession
, numFrames = numFrames
, exprLogs = Dict.fromList exprLogs
, runningState = Playing
, nodeLogs =
nodeLogs
|> List.filter (\(nodeId, _) -> nodeId /= mainId)
|> Dict.fromList
Expand All @@ -382,7 +385,7 @@ update msg state =
)

PausedResponse frameIdx record ->
( { state | runningState <- Paused frameIdx record }
( { state | runningState = Paused frameIdx record }
, none
)

Expand Down
Loading

0 comments on commit 6a7b6f9

Please sign in to comment.