Skip to content

Commit c9a053e

Browse files
authored
Merge pull request #25 from purescript-contrib/compiler/0.12
Compiler/0.12
2 parents 995faed + b871f75 commit c9a053e

File tree

5 files changed

+28
-24
lines changed

5 files changed

+28
-24
lines changed

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@ language: node_js
22
dist: trusty
33
sudo: required
44
node_js: 6
5+
env:
6+
- PATH=$HOME/purescript:$PATH
57
install:
8+
- npm install -g bower
9+
- TAG=$(wget -q -O - https://github.com/purescript/purescript/releases/latest --server-response --max-redirect 0 2>&1 | sed -n -e 's/.*Location:.*tag\///p')
10+
- wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
11+
- tar -xvf $HOME/purescript.tar.gz -C $HOME/
12+
- chmod a+x $HOME/purescript
613
- npm install -g bower
714
- npm install
15+
- bower install --production
816
script:
917
- bower install --production
1018
- npm run -s build

bower.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
{
22
"name": "purescript-options",
3-
"homepage": "https://github.com/ethul/purescript-options",
3+
"homepage": "https://github.com/purescript-contrib/purescript-options",
44
"description": "PureScript Options",
55
"keywords": [
66
"purescript"
77
],
88
"license": "MIT",
99
"repository": {
1010
"type": "git",
11-
"url": "git://github.com/ethul/purescript-options.git"
11+
"url": "git://github.com/purescript-contrib/purescript-options.git"
1212
},
1313
"ignore": [
1414
"*",
1515
"!src/**/*",
1616
"!LICENSE"
1717
],
1818
"dependencies": {
19-
"purescript-foreign": "^4.0.0",
20-
"purescript-maps": "^3.0.0",
21-
"purescript-tuples": "^4.0.0",
22-
"purescript-monoid": "^3.0.0",
23-
"purescript-maybe": "^3.0.0",
24-
"purescript-contravariant": "^3.0.0"
19+
"purescript-foreign": "^5.0.0",
20+
"purescript-foreign-object": "^1.0.0",
21+
"purescript-tuples": "^5.0.0",
22+
"purescript-maybe": "^4.0.0",
23+
"purescript-contravariant": "^4.0.0"
2524
},
2625
"devDependencies": {
27-
"purescript-console": "^3.0.0"
26+
"purescript-console": "^4.1.0"
2827
}
2928
}

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
"test": "pulp test"
77
},
88
"devDependencies": {
9-
"pulp": "^11.0.0",
10-
"purescript-psa": "^0.5.0",
11-
"purescript": "^0.11.1",
12-
"rimraf": "^2.5.4"
9+
"pulp": "^12.2.0",
10+
"purescript-psa": "^0.6.0",
11+
"rimraf": "^2.6.2"
1312
}
1413
}

src/Data/Options.purs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,12 @@ module Data.Options
9797

9898
import Prelude
9999

100-
import Data.Foreign (toForeign, Foreign)
101100
import Data.Maybe (Maybe, maybe)
102-
import Data.Monoid (mempty, class Monoid)
103101
import Data.Newtype (class Newtype, unwrap)
104102
import Data.Op (Op(..))
105-
import Data.StrMap as StrMap
106103
import Data.Tuple (Tuple(..))
104+
import Foreign (Foreign, unsafeToForeign)
105+
import Foreign.Object as Object
107106

108107
-- | The `Options` type represents a set of options. The type argument is a
109108
-- | phantom type, which is useful for ensuring that options for one particular
@@ -117,7 +116,7 @@ derive newtype instance monoidOptions ∷ Monoid (Options opt)
117116
-- | Convert an `Options` value into a JavaScript object, suitable for passing
118117
-- | to JavaScript APIs.
119118
options :: forall opt. Options opt -> Foreign
120-
options (Options os) = toForeign (StrMap.fromFoldable os)
119+
options (Options os) = unsafeToForeign (Object.fromFoldable os)
121120

122121
-- | An `Option` represents an opportunity to configure a specific attribute
123122
-- | of a call to some API. This normally corresponds to one specific property
@@ -148,8 +147,8 @@ tag :: forall opt value. Option opt value -> value -> Option opt Unit
148147
tag o value = Op \_ -> o := value
149148

150149
-- | The default method for turning a string property key into an
151-
-- | `Option`. This function simply calls `toForeign` on the value. If
150+
-- | `Option`. This function simply calls `unsafeToForeign` on the value. If
152151
-- | you need some other behaviour, you can write your own function to replace
153152
-- | this one, and construct an `Option` yourself.
154153
defaultToOptions :: forall opt value. String -> value -> Options opt
155-
defaultToOptions k v = Options [Tuple k (toForeign v)]
154+
defaultToOptions k v = Options [Tuple k (unsafeToForeign v)]

test/Test/Main.purs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ module Test.Main where
22

33
import Prelude
44

5-
import Control.Monad.Eff (Eff)
6-
import Control.Monad.Eff.Console (CONSOLE, log)
7-
8-
import Data.Foreign (Foreign)
95
import Data.Functor.Contravariant (cmap)
106
import Data.Maybe (Maybe(..))
117
import Data.Options (Option, Options, optional, options, opt, (:=))
8+
import Effect (Effect)
9+
import Effect.Console (log)
10+
import Foreign (Foreign)
1211

1312
data Shape = Circle | Square | Triangle
1413

@@ -53,7 +52,7 @@ opts = foo := "aaa" <>
5352
buz := (\a b c -> a + b + c) <>
5453
fuz := [Square, Circle, Triangle]
5554

56-
main :: forall eff. Eff (console :: CONSOLE | eff) Unit
55+
main :: Effect Unit
5756
main = log <<< showForeign <<< options $ opts
5857

5958
foreign import showForeign :: Foreign -> String

0 commit comments

Comments
 (0)