Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to v0.14.0-rc3 #90

Merged
merged 3 commits into from
Dec 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:

- name: Set up a PureScript toolchain
uses: purescript-contrib/setup-purescript@main
with:
purescript: "0.14.0-rc3"

- name: Cache PureScript dependencies
uses: actions/cache@v2
Expand Down
2 changes: 1 addition & 1 deletion packages.dhall
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let upstream =
https://github.com/purescript/package-sets/releases/download/psc-0.13.8-20200831/packages.dhall sha256:cdb3529cac2cd8dd780f07c80fd907d5faceae7decfcaa11a12037df68812c83
https://raw.githubusercontent.com/purescript/package-sets/prepare-0.14/src/packages.dhall

in upstream
16 changes: 8 additions & 8 deletions src/Data/Argonaut/Decode/Class.purs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import Data.Maybe (Maybe(..))
import Data.NonEmpty (NonEmpty)
import Data.Set as S
import Data.String (CodePoint)
import Data.Symbol (class IsSymbol, SProxy(..), reflectSymbol)
import Data.Symbol (class IsSymbol, reflectSymbol)
import Data.Tuple (Tuple)
import Foreign.Object as FO
import Prelude (class Ord, Unit, Void, bind, ($), (<<<))
import Prim.Row as Row
import Prim.RowList as RL
import Record as Record
import Type.Data.RowList (RLProxy(..))
import Type.Proxy (Proxy(..))

class DecodeJson a where
decodeJson :: Json -> Either JsonDecodeError a
Expand Down Expand Up @@ -97,11 +97,11 @@ instance decodeRecord
=> DecodeJson (Record row) where
decodeJson json =
case toObject json of
Just object -> gDecodeJson object (RLProxy :: RLProxy list)
Just object -> gDecodeJson object (Proxy :: Proxy list)
Nothing -> Left $ TypeMismatch "Object"

class GDecodeJson (row :: # Type) (list :: RL.RowList) | list -> row where
gDecodeJson :: FO.Object Json -> RLProxy list -> Either JsonDecodeError (Record row)
class GDecodeJson (row :: Row Type) (list :: RL.RowList Type) | list -> row where
gDecodeJson :: forall proxy. FO.Object Json -> proxy list -> Either JsonDecodeError (Record row)

instance gDecodeJsonNil :: GDecodeJson () RL.Nil where
gDecodeJson _ _ = Right {}
Expand All @@ -115,14 +115,14 @@ instance gDecodeJsonCons
)
=> GDecodeJson row (RL.Cons field value tail) where
gDecodeJson object _ = do
let
_field = SProxy :: SProxy field
let
_field = Proxy :: Proxy field
fieldName = reflectSymbol _field

case FO.lookup fieldName object of
Just jsonVal -> do
val <- lmap (AtKey fieldName) <<< decodeJson $ jsonVal
rest <- gDecodeJson object (RLProxy :: RLProxy tail)
rest <- gDecodeJson object (Proxy :: Proxy tail)
Right $ Record.insert _field val rest

Nothing ->
Expand Down
14 changes: 7 additions & 7 deletions src/Data/Argonaut/Encode/Class.purs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import Data.Maybe (Maybe)
import Data.NonEmpty (NonEmpty)
import Data.Set as S
import Data.String (CodePoint)
import Data.Symbol (class IsSymbol, SProxy(..), reflectSymbol)
import Data.Symbol (class IsSymbol, reflectSymbol)
import Data.Tuple (Tuple)
import Foreign.Object as FO
import Prelude (class Ord, Unit, Void, identity, ($))
import Prim.Row as Row
import Prim.RowList as RL
import Record as Record
import Type.Data.RowList (RLProxy(..))
import Type.Proxy (Proxy(..))

class EncodeJson a where
encodeJson :: a -> Json
Expand Down Expand Up @@ -96,10 +96,10 @@ instance encodeRecord
, RL.RowToList row list
)
=> EncodeJson (Record row) where
encodeJson rec = fromObject $ gEncodeJson rec (RLProxy :: RLProxy list)
encodeJson rec = fromObject $ gEncodeJson rec (Proxy :: Proxy list)

class GEncodeJson (row :: # Type) (list :: RL.RowList) where
gEncodeJson :: Record row -> RLProxy list -> FO.Object Json
class GEncodeJson (row :: Row Type) (list :: RL.RowList Type) where
gEncodeJson :: forall proxy. Record row -> proxy list -> FO.Object Json

instance gEncodeJsonNil :: GEncodeJson row RL.Nil where
gEncodeJson _ _ = FO.empty
Expand All @@ -112,8 +112,8 @@ instance gEncodeJsonCons
)
=> GEncodeJson row (RL.Cons field value tail) where
gEncodeJson row _ = do
let _field = SProxy :: SProxy field
let _field = Proxy :: Proxy field
FO.insert
(reflectSymbol _field)
(encodeJson $ Record.get _field row)
(gEncodeJson row (RLProxy :: RLProxy tail))
(gEncodeJson row (Proxy :: Proxy tail))