Skip to content

Commit 9012eb0

Browse files
authored
Merge pull request #29 from purescript/compiler/0.12
Update for PureScript 0.12
2 parents 740d3f9 + a55c1b9 commit 9012eb0

File tree

7 files changed

+48
-48
lines changed

7 files changed

+48
-48
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
/bower_components/
66
/node_modules/
77
/output/
8+
package-lock.json

LICENSE

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1-
The MIT License (MIT)
1+
Copyright 2018 PureScript
22

3-
Copyright (c) 2014 PureScript
3+
Redistribution and use in source and binary forms, with or without modification,
4+
are permitted provided that the following conditions are met:
45

5-
Permission is hereby granted, free of charge, to any person obtaining a copy of
6-
this software and associated documentation files (the "Software"), to deal in
7-
the Software without restriction, including without limitation the rights to
8-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9-
the Software, and to permit persons to whom the Software is furnished to do so,
10-
subject to the following conditions:
6+
1. Redistributions of source code must retain the above copyright notice, this
7+
list of conditions and the following disclaimer.
118

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
9+
2. Redistributions in binary form must reproduce the above copyright notice,
10+
this list of conditions and the following disclaimer in the documentation and/or
11+
other materials provided with the distribution.
1412

15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13+
3. Neither the name of the copyright holder nor the names of its contributors
14+
may be used to endorse or promote products derived from this software without
15+
specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
21+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

bower.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "purescript-exceptions",
33
"homepage": "https://github.com/purescript/purescript-exceptions",
4-
"description": "Exception effects",
5-
"license": "MIT",
4+
"license": "BSD-3-Clause",
65
"repository": {
76
"type": "git",
87
"url": "git://github.com/purescript/purescript-exceptions.git"
@@ -17,8 +16,9 @@
1716
"package.json"
1817
],
1918
"dependencies": {
20-
"purescript-eff": "^3.0.0",
21-
"purescript-either": "^3.0.0",
22-
"purescript-maybe": "^3.0.0"
19+
"purescript-effect": "^2.0.0",
20+
"purescript-either": "^4.0.0",
21+
"purescript-maybe": "^4.0.0",
22+
"purescript-prelude": "^4.0.0"
2323
}
2424
}

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"build": "eslint src && pulp build -- --censor-lib --strict"
66
},
77
"devDependencies": {
8-
"eslint": "^3.17.1",
9-
"pulp": "^10.0.4",
10-
"purescript-psa": "^0.5.0-rc.1",
11-
"rimraf": "^2.6.1"
8+
"eslint": "^4.19.1",
9+
"pulp": "^12.2.0",
10+
"purescript-psa": "^0.6.0",
11+
"rimraf": "^2.6.2"
1212
}
1313
}
File renamed without changes.

src/Control/Monad/Eff/Exception.purs renamed to src/Effect/Exception.purs

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
-- | This module defines an effect, actions and handlers for working
22
-- | with JavaScript exceptions.
33

4-
module Control.Monad.Eff.Exception
5-
( EXCEPTION
6-
, Error
4+
module Effect.Exception
5+
( Error
76
, error
87
, message
98
, name
@@ -16,14 +15,11 @@ module Control.Monad.Eff.Exception
1615

1716
import Prelude
1817

19-
import Control.Monad.Eff (Eff, kind Effect)
18+
import Effect (Effect)
2019

2120
import Data.Either (Either(..))
2221
import Data.Maybe (Maybe(..))
2322

24-
-- | This effect is used to annotate code which possibly throws exceptions
25-
foreign import data EXCEPTION :: Effect
26-
2723
-- | The type of JavaScript errors
2824
foreign import data Error :: Type
2925

@@ -62,29 +58,27 @@ foreign import stackImpl
6258
-- | error "Expected a non-negative number"
6359
-- | ```
6460
foreign import throwException
65-
:: forall a eff
61+
:: forall a
6662
. Error
67-
-> Eff (exception :: EXCEPTION | eff) a
63+
-> Effect a
6864

6965
-- | Catch an exception by providing an exception handler.
7066
-- |
71-
-- | This handler removes the `EXCEPTION` effect.
72-
-- |
7367
-- | For example:
7468
-- |
7569
-- | ```purescript
7670
-- | main = catchException print do
7771
-- | Console.log "Exceptions thrown in this block will be logged to the console"
7872
-- | ```
7973
foreign import catchException
80-
:: forall a eff
81-
. (Error -> Eff eff a)
82-
-> Eff (exception :: EXCEPTION | eff) a
83-
-> Eff eff a
74+
:: forall a
75+
. (Error -> Effect a)
76+
-> Effect a
77+
-> Effect a
8478

8579
-- | A shortcut allowing you to throw an error in one step. Defined as
8680
-- | `throwException <<< error`.
87-
throw :: forall eff a. String -> Eff (exception :: EXCEPTION | eff) a
81+
throw :: forall a. String -> Effect a
8882
throw = throwException <<< error
8983

9084
-- | Runs an Eff and returns eventual Exceptions as a `Left` value. If the
@@ -93,8 +87,7 @@ throw = throwException <<< error
9387
-- | For example:
9488
-- |
9589
-- | ```purescript
96-
-- | -- Notice that there is no EXCEPTION effect
97-
-- | main :: forall eff. Eff (console :: CONSOLE, fs :: FS | eff) Unit
90+
-- | main :: forall eff. Effect Unit
9891
-- | main = do
9992
-- | result <- try (readTextFile UTF8 "README.md")
10093
-- | case result of
@@ -104,5 +97,5 @@ throw = throwException <<< error
10497
-- | Console.error ("Couldn't open README.md. Error was: " <> show error)
10598
-- | ```
10699

107-
try :: forall eff a. Eff (exception :: EXCEPTION | eff) a -> Eff eff (Either Error a)
100+
try :: forall a. Effect a -> Effect (Either Error a)
108101
try action = catchException (pure <<< Left) (Right <$> action)

src/Control/Monad/Eff/Exception/Unsafe.purs renamed to src/Effect/Exception/Unsafe.purs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
module Control.Monad.Eff.Exception.Unsafe where
1+
module Effect.Exception.Unsafe where
22

3-
import Control.Monad.Eff.Exception (Error, error, throwException)
4-
import Control.Monad.Eff.Unsafe (unsafePerformEff)
3+
import Effect.Exception (Error, error, throwException)
4+
import Effect.Unsafe (unsafePerformEffect)
55
import Control.Semigroupoid ((<<<))
66

77
-- | Throw an exception in pure code. This function should be used very
88
-- | sparingly, as it can cause unexpected crashes at runtime.
99
unsafeThrowException :: forall a. Error -> a
10-
unsafeThrowException = unsafePerformEff <<< throwException
10+
unsafeThrowException = unsafePerformEffect <<< throwException
1111

1212
-- | Defined as `unsafeThrowException <<< error`.
1313
unsafeThrow :: forall a. String -> a

0 commit comments

Comments
 (0)