Skip to content

Commit

Permalink
Migrate to PureScript 0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
fsoikin committed Feb 28, 2021
1 parent 46f0999 commit c9ceaa4
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.psci*
bower_components/
node_modules/
output/
.psc-package
.psc-ide-port
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ First, define some data type and derive `Generic`:
```purescript
> import Prelude
> import Data.Generic.Rep (class Generic)
> import Data.Generic.Rep.Show (genericShow)
> import Data.Show.Generic (genericShow)
> newtype MyRecord = MyRecord { a :: Int }
> derive instance genericMyRecord :: Generic MyRecord _
Expand Down
20 changes: 9 additions & 11 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,16 @@
"url": "git://github.com/paf31/purescript-foreign-generic.git"
},
"dependencies": {
"purescript-effect": "^2.0.0",
"purescript-foreign": "^5.0.0",
"purescript-foreign-object": "^2.0.0",
"purescript-generics-rep": "^6.0.0",
"purescript-ordered-collections": "^1.0.0",
"purescript-proxy": "^3.0.0",
"purescript-exceptions": "^4.0.0",
"purescript-record": "^2.0.0",
"purescript-identity": "^4.1.0"
"purescript-effect": "^3.0.0",
"purescript-foreign": "^6.0.0",
"purescript-foreign-object": "^3.0.0",
"purescript-ordered-collections": "^2.0.0",
"purescript-exceptions": "^5.0.0",
"purescript-record": "^3.0.0",
"purescript-identity": "^5.0.0"
},
"devDependencies": {
"purescript-assert": "^4.0.0",
"purescript-psci-support": "^4.0.0"
"purescript-assert": "^5.0.0",
"purescript-psci-support": "^5.0.0"
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"test": "pulp test"
},
"devDependencies": {
"pulp": "^12.0.0",
"purescript": "^0.12.0",
"pulp": "^15.0.0",
"purescript": "^0.14.0",
"purescript-psa": "^0.5.0",
"rimraf": "^2.5.0"
}
Expand Down
2 changes: 1 addition & 1 deletion src/Foreign/Generic.purs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import Foreign (F, Foreign)
import Foreign (F, Foreign, ForeignError(..)) as Reexports
import Foreign.Generic.Class (class Decode, class Encode, class GenericDecode, class GenericEncode, Options, decode, decodeOpts, encode, encodeOpts)
import Foreign.Generic.Class (class Decode, class Encode, class GenericDecode, class GenericEncode, Options, SumEncoding(..), defaultOptions, decode, encode) as Reexports
import Foreign.Internal.Stringify (unsafeStringify)
import Foreign.JSON (decodeJSONWith, parseJSON)
import Global.Unsafe (unsafeStringify)

-- | Read a value which has a `Generic` type.
genericDecode
Expand Down
3 changes: 3 additions & 0 deletions src/Foreign/Internal/Stringify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
exports.unsafeStringify = function (x) {
return JSON.stringify(x);
};
5 changes: 5 additions & 0 deletions src/Foreign/Internal/Stringify.purs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Foreign.Internal.Stringify (unsafeStringify) where

-- | Uses the global JSON object to turn anything into a string. Careful! Trying
-- | to serialize functions returns undefined
foreign import unsafeStringify :: forall a. a -> String
2 changes: 1 addition & 1 deletion test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import Foreign (isNull, unsafeToForeign)
import Foreign.Generic (class Decode, class Encode, class GenericDecode, class GenericEncode, Options, decode, encode, defaultOptions, decodeJSON, encodeJSON, genericDecodeJSON, genericEncodeJSON)
import Foreign.Generic.EnumEncoding (class GenericDecodeEnum, class GenericEncodeEnum, GenericEnumOptions, genericDecodeEnum, genericEncodeEnum)
import Foreign.Index (readProp)
import Foreign.Internal.Stringify (unsafeStringify)
import Foreign.JSON (parseJSON)
import Foreign.Object as Object
import Global.Unsafe (unsafeStringify)
import Test.Assert (assert, assert')
import Test.Types (Fruit(..), IntList(..), RecordTest(..), Tree(..), TupleArray(..), UndefinedTest(..))

Expand Down
4 changes: 2 additions & 2 deletions test/Types.purs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import Foreign (ForeignError(..), fail, readArray, unsafeToForeign)
import Foreign.Generic (class Encode, class Decode, Options, SumEncoding(..), encode, decode, defaultOptions, genericDecode, genericEncode)
import Foreign.Generic.EnumEncoding (defaultGenericEnumOptions, genericDecodeEnum, genericEncodeEnum)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Data.Generic.Rep.Show (genericShow)
import Data.Eq.Generic (genericEq)
import Data.Show.Generic (genericShow)
import Data.Maybe (Maybe)
import Data.Tuple (Tuple(..))

Expand Down

0 comments on commit c9ceaa4

Please sign in to comment.