diff --git a/.psc-ide-port b/.psc-ide-port new file mode 100644 index 0000000..6a79f11 --- /dev/null +++ b/.psc-ide-port @@ -0,0 +1 @@ +15073 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index dd9c7d7..49e88af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: node_js sudo: false node_js: - - 5 + - 7 before_install: - curl -L https://raw.githubusercontent.com/futurice/fum2github/3a270cf7a3b600900c1a8ed07c23d5f3ba8b115d/travis_long > travis_long && chmod +x travis_long install: diff --git a/bower.json b/bower.json index e6b92e4..dad4ea9 100644 --- a/bower.json +++ b/bower.json @@ -20,14 +20,16 @@ "bower.json", "package.json" ], + "version": "0.2.1", "dependencies": { - "purescript-eff": "1.0.0", - "purescript-generics": "1.0.0", - "purescript-argonaut-codecs": "1.0.0" + "purescript-eff": "^3.1.0", + "purescript-generics": "^4.0.0", + "purescript-argonaut-codecs": "^3.2.0", + "purescript-argonaut-generic": "^1.2.0", + "purescript-avar": "^2.0.1" }, "devDependencies": { - "purescript-console": "1.0.0", - "purescript-spec": "0.8.0" - }, - "version": "0.2.1" + "purescript-console": "^3.0.0", + "purescript-spec": "^2.0.0" + } } diff --git a/package.json b/package.json index ed09c4f..cf8af92 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "test": "pulp test" }, "devDependencies": { - "pulp": "9.0.1", - "purescript": "0.9.1" + "pulp": "^11.0.2", + "purescript": "^0.11.6", + "purescript-psa": "^0.5.1" } } diff --git a/src/Electron.purs b/src/Electron.purs index c254762..92763f7 100644 --- a/src/Electron.purs +++ b/src/Electron.purs @@ -1,4 +1,6 @@ module Electron where +import Control.Monad.Eff (kind Effect) + -- | The `ELECTRON` effect represents computations which require and affect the Electron environment. -foreign import data ELECTRON :: ! +foreign import data ELECTRON :: Effect diff --git a/src/Electron/BrowserWindow.purs b/src/Electron/BrowserWindow.purs index e0a2c29..4045b6e 100644 --- a/src/Electron/BrowserWindow.purs +++ b/src/Electron/BrowserWindow.purs @@ -42,7 +42,7 @@ derive instance genericBrowserWindowOption :: Generic BrowserWindowOption derive instance genericWebPreference :: Generic WebPreference -foreign import data BrowserWindow :: * +foreign import data BrowserWindow :: Type newBrowserWindow :: forall eff . BrowserWindowOptions @@ -63,7 +63,7 @@ foreign import onClose :: forall eff -> Eff (electron :: ELECTRON | eff) Unit -> Eff (electron :: ELECTRON | eff) Unit -foreign import data WebContents :: * +foreign import data WebContents :: Type foreign import webContents :: forall eff . BrowserWindow diff --git a/src/Electron/Event.purs b/src/Electron/Event.purs index b271c99..f1ffac0 100644 --- a/src/Electron/Event.purs +++ b/src/Electron/Event.purs @@ -8,7 +8,7 @@ import Prelude (Unit) import Control.Monad.Eff (Eff) import Electron (ELECTRON) -foreign import data Event :: * +foreign import data Event :: Type foreign import preventDefault :: forall e. Event -> Eff (electron :: ELECTRON | e) Unit diff --git a/src/Electron/Options.purs b/src/Electron/Options.purs index acdf80e..affdda5 100644 --- a/src/Electron/Options.purs +++ b/src/Electron/Options.purs @@ -2,15 +2,16 @@ module Electron.Options ( encodeOptions ) where -import Prelude ((+), (>>>), unit, (#), map) import Data.Argonaut.Core (Json) -import Data.Argonaut.Encode (encodeJson, gEncodeJson') +import Data.Argonaut.Encode (encodeJson) import Data.Foldable (foldl) -import Data.Generic (class Generic, GenericSpine(SArray, SProd), toSpine) +import Data.Generic (class Generic, GenericSpine(..), toSpine) +import Data.Argonaut.Encode.Generic import Data.Maybe (Maybe(Just)) import Data.Monoid ((<>)) -import Data.String (drop, lastIndexOf, take, toLower) import Data.StrMap as M +import Data.String (drop, lastIndexOf, take, toLower, Pattern(..)) +import Prelude ((+), (>>>), unit, (#), map) encodeOptions :: forall a. (Generic a) => Array a -> Json encodeOptions = map toSpine >>> encodeOptions' @@ -32,6 +33,6 @@ toCamelCase s = toLower (take 1 s) <> drop 1 s simpleName :: String -> String simpleName qname = - case lastIndexOf "." qname of + case (lastIndexOf (Pattern ".") qname) of Just index -> drop (index + 1) qname _ -> qname diff --git a/src/Electron/Types.purs b/src/Electron/Types.purs index 1ef8c1d..23aeb82 100644 --- a/src/Electron/Types.purs +++ b/src/Electron/Types.purs @@ -5,13 +5,13 @@ module Electron.Types ) where import Prelude (Unit) -import Control.Monad.Eff (Eff) +import Control.Monad.Eff (Eff, kind Effect) import Electron (ELECTRON) import Electron.Event (Event) -- | A boxed function that can be used as an event listener. This is necessary -- | due to the underling implementation of Eff functions. -foreign import data Listener :: # ! -> * +foreign import data Listener :: # Effect -> Type -- | Creates a Listener from a normal PureScript Eff function. foreign import mkListener diff --git a/test/Main.purs b/test/Main.purs index 1ec9cad..a09490b 100644 --- a/test/Main.purs +++ b/test/Main.purs @@ -3,8 +3,9 @@ module Test.Main where import Prelude (Unit) import Control.Monad.Eff (Eff) +import Control.Monad.Eff.AVar import Control.Monad.Eff.Console (CONSOLE) -import Node.Process (PROCESS) + import Data.Argonaut.Encode.Combinators ((~>), (:=)) import Data.Argonaut.Core (jsonEmptyObject) @@ -12,12 +13,12 @@ import Data.Argonaut.Core (jsonEmptyObject) import Test.Spec (it, describe) import Test.Spec.Assertions (shouldEqual) import Test.Spec.Reporter.Console (consoleReporter) -import Test.Spec.Runner (run) +import Test.Spec.Runner (run, PROCESS) import Electron.BrowserWindow (BrowserWindowOption(WebPreferences, Height, Width), WebPreference(OverlayScrollbars)) import Electron.Options (encodeOptions) -main :: forall eff. Eff (process :: PROCESS, console :: CONSOLE | eff) Unit +main :: forall eff. Eff (process :: PROCESS, console :: CONSOLE, avar :: AVAR | eff) Unit main = run [consoleReporter] do describe "encodeOptions :: BrowserWindowOptions -> Json" do it "can encode all options" do