Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Update to and for PureScript 0.11 #63

Merged
merged 4 commits into from
Apr 29, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "gulp-purescript",
"private": true,
"dependencies": {
"purescript-aff": "~0.17.0",
"purescript-foreign": "~1.0.0"
"purescript-aff": "~3.0.0",
"purescript-foreign": "~4.0.0"
}
}
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,30 @@
"output"
],
"scripts": {
"psc": "psc 'src/**/*.purs' 'bower_components/purescript-*/src/**/*.purs'",
"psc": "purs compile 'src/**/*.purs' 'bower_components/purescript-*/src/**/*.purs'",
"test": "npm run psc && (node test/test.js | tap-spec)",
"prepublish": "rm -r output && npm run psc"
"prepublish": "rimraf output && npm run psc"
},
"keywords": [
"gulpplugin",
"purescript"
],
"dependencies": {
"async": "^2.0.0-rc.5",
"camelcase": "^3.0.0",
"cross-spawn": "^4.0.0",
"glob": "^7.0.3",
"gulp-util": "^3.0.7",
"async": "^2.3.0",
"camelcase": "^4.1.0",
"cross-spawn": "^5.1.0",
"glob": "^7.1.1",
"gulp-util": "^3.0.8",
"logalot": "^2.1.0",
"resolve-bin": "^0.4.0",
"which": "^1.2.9"
"which": "^1.2.14"
},
"devDependencies": {
"gulp": "^3.9.1",
"purescript": "^0.9.1-rc.1",
"purescript": "^0.11.4",
"rimraf": "^2.6.1",
"tap-spec": "^4.1.1",
"tape": "^4.5.1",
"through2": "^2.0.1"
"tape": "^4.6.3",
"through2": "^2.0.3"
}
}
4 changes: 2 additions & 2 deletions src/GulpPurescript/ChildProcess.purs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ module GulpPurescript.ChildProcess
import Prelude

import Control.Monad.Aff (Aff, makeAff)
import Control.Monad.Eff (Eff)
import Control.Monad.Eff (Eff, kind Effect)
import Control.Monad.Eff.Exception (Error)

import Data.Function.Uncurried (Fn4, runFn4)

foreign import data ChildProcess :: !
foreign import data ChildProcess :: Effect

spawn :: forall eff. String -> Array String -> Aff (cp :: ChildProcess | eff) String
spawn command args = makeAff $ runFn4 spawnFn command args
Expand Down
4 changes: 2 additions & 2 deletions src/GulpPurescript/Glob.purs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ module GulpPurescript.Glob
import Prelude (Unit, ($))

import Control.Monad.Aff (Aff, makeAff)
import Control.Monad.Eff (Eff)
import Control.Monad.Eff (Eff, kind Effect)
import Control.Monad.Eff.Exception (Error)

import Data.Function.Uncurried (Fn3, runFn3)

foreign import data Glob :: !
foreign import data Glob :: Effect

glob :: forall eff. String -> Aff (glob :: Glob | eff) (Array String)
glob pattern = makeAff $ runFn3 globFn pattern
Expand Down
4 changes: 2 additions & 2 deletions src/GulpPurescript/Logalot.purs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ module GulpPurescript.Logalot

import Prelude (Unit)

import Control.Monad.Eff (Eff)
import Control.Monad.Eff (Eff, kind Effect)

foreign import data Logalot :: !
foreign import data Logalot :: Effect

foreign import info :: forall eff. String -> Eff (logalot :: Logalot | eff) Unit
35 changes: 18 additions & 17 deletions src/GulpPurescript/OS.purs
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,35 @@ module GulpPurescript.OS
, platform
) where

import Prelude (class Show, (<$>), (<>), const)
import Prelude

import Control.Monad.Eff (Eff)
import Control.Monad.Eff (Eff, kind Effect)
import Control.Monad.Eff.Exception.Unsafe (unsafeThrow)
import Control.Monad.Except (runExcept)

import Data.Either (either)
import Data.Foreign (Foreign)
import Data.Foreign.Class (class IsForeign, read)
import Data.Foreign (F, Foreign, readString)
import Data.Maybe (Maybe(..))

foreign import data OS :: !
foreign import data OS :: Effect

data Platform = Darwin | Linux | Win32

instance showPlatform :: Show Platform where
show a = case a of
Darwin -> "darwin"
Linux -> "linux"
Win32 -> "win32"

instance isForeignPlatform :: IsForeign Platform where
read a = (\a -> case a of
"darwin" -> Darwin
"linux" -> Linux
"win32" -> Win32
_ -> unsafeThrow ("Unhandled platform: " <> a)) <$> read a
show = case _ of
Darwin -> "darwin"
Linux -> "linux"
Win32 -> "win32"

readPlatform :: Foreign -> F Platform
readPlatform =
readString >=> case _ of
"darwin" -> pure Darwin
"linux" -> pure Linux
"win32" -> pure Win32
a -> unsafeThrow ("Unhandled platform: " <> a)

platform :: forall eff. Eff (os :: OS | eff) (Maybe Platform)
platform = either (const Nothing) Just <$> read <$> platformFn
platform = either (const Nothing) Just <$> runExcept <$> readPlatform <$> platformFn

foreign import platformFn :: forall eff. Eff (os :: OS | eff) Foreign
Loading