Skip to content

Bump versions, and make it compile with PS 0.14 #6

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
23 changes: 0 additions & 23 deletions bower.json

This file was deleted.

94 changes: 35 additions & 59 deletions packages.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ Welcome to your new Dhall package-set!
Below are instructions for how to edit this file for most use
cases, so that you don't need to know Dhall to use it.

## Warning: Don't Move This Top-Level Comment!

Due to how `dhall format` currently works, this comment's
instructions cannot appear near corresponding sections below
because `dhall format` will delete the comment. However,
it will not delete a top-level comment like this one.

## Use Cases

Most will want to do one or both of these options:
Expand All @@ -31,28 +24,25 @@ Purpose:
the package set's repo

Syntax:
Replace the overrides' "{=}" (an empty record) with the following idea
The "//" or "⫽" means "merge these two records and
when they have the same value, use the one on the right:"
where `entityName` is one of the following:
- dependencies
- repo
- version
-------------------------------
let overrides =
{ packageName =
upstream.packageName // { updateEntity1 = "new value", updateEntity2 = "new value" }
, packageName =
upstream.packageName // { version = "v4.0.0" }
, packageName =
upstream.packageName // { repo = "https://www.example.com/path/to/new/repo.git" }
}
let upstream = --
in upstream
with packageName.entityName = "new value"
-------------------------------

Example:
-------------------------------
let overrides =
{ halogen =
upstream.halogen // { version = "master" }
, halogen-vdom =
upstream.halogen-vdom // { version = "v4.0.0" }
}
let upstream = --
in upstream
with halogen.version = "master"
with halogen.repo = "https://example.com/path/to/git/repo.git"

with halogen-vdom.version = "v4.0.0"
with halogen-vdom.dependencies = [ "extra-dependency" ] # halogen-vdom.dependencies
-------------------------------

### Additions
Expand All @@ -61,37 +51,30 @@ Purpose:
- Add packages that aren't already included in the default package set

Syntax:
Replace the additions' "{=}" (an empty record) with the following idea:
where `<version>` is:
- a tag (i.e. "v4.0.0")
- a branch (i.e. "master")
- commit hash (i.e. "701f3e44aafb1a6459281714858fadf2c4c2a977")
-------------------------------
let additions =
{ package-name =
{ dependencies =
[ "dependency1"
, "dependency2"
]
, repo =
"https://example.com/path/to/git/repo.git"
, version =
"tag ('v4.0.0') or branch ('master')"
}
, package-name =
{ dependencies =
[ "dependency1"
, "dependency2"
]
, repo =
"https://example.com/path/to/git/repo.git"
, version =
"tag ('v4.0.0') or branch ('master')"
}
, etc.
}
let upstream = --
in upstream
with new-package-name =
{ dependencies =
[ "dependency1"
, "dependency2"
]
, repo =
"https://example.com/path/to/git/repo.git"
, version =
"<version>"
}
-------------------------------

Example:
-------------------------------
let additions =
{ benchotron =
let upstream = --
in upstream
with benchotron =
{ dependencies =
[ "arrays"
, "exists"
Expand All @@ -113,16 +96,9 @@ let additions =
, version =
"v7.0.0"
}
}
-------------------------------
-}


let upstream =
https://github.com/purescript/package-sets/releases/download/psc-0.13.6-20200423/packages.dhall sha256:c180a06bb5444fd950f8cbdd6605c644fd246deb397e62572b8f4a6b9dbcaf22

let overrides = {=}

let additions = {=}
https://github.com/purescript/package-sets/releases/download/psc-0.14.5-20211116/packages.dhall sha256:7ba810597a275e43c83411d2ab0d4b3c54d0b551436f4b1632e9ff3eb62e327a

in upstream // overrides // additions
in upstream
16 changes: 13 additions & 3 deletions spago.dhall
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
{-
Welcome to a Spago project!
You can edit this file as you like.

Need help? See the following resources:
- Spago documentation: https://github.com/purescript/spago
- Dhall language tour: https://docs.dhall-lang.org/tutorials/Language-Tour.html

When creating a new Spago project, you can use
`spago init --no-comments` or `spago init -C`
to generate this file without the comments in this block.
-}
{ name = "tuples-native"
, dependencies =
[ "generics-rep"
[ "console"
, "effect"
, "functions"
, "prelude"
, "psci-support"
, "tuples"
, "typelevel"
, "unsafe-coerce"
, "functions"
, "typelevel-prelude"
]
, packages = ./packages.dhall
, sources = [ "src/**/*.purs", "test/**/*.purs" ]
Expand Down
60 changes: 29 additions & 31 deletions src/Data/Tuple/Native.purs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Data.Tuple.Nested as DTN
import Data.Typelevel.Num (D0, D1, D2, D3, D4, D5, D6, D7, D8, D9, class Lt, class Nat, toInt, d0, d1, d2, d3, d4, d5, d6, d7, d8)
import Prelude (($))
import Prim.Row (class Cons)
import Type.RowList (Cons, Nil, kind RowList, class ListToRow)
import Type.RowList (Cons, Nil, RowList, class ListToRow)

-- | Safely coerce a `TupleN` pair into a PureScript Tuple
xt :: forall a b. T2 a b -> DT.Tuple a b
Expand Down Expand Up @@ -62,11 +62,8 @@ prj :: forall t t' t'' n n' a size
=> n -> TupleN t -> a
prj n t = runFn2 prjImpl (toInt n) t



-- | Represented as a heterogeneous array under the hood
foreign import data TupleN :: RowList -> Type

foreign import data TupleN :: RowList Type -> Type

type T2 a b =
TupleN (Cons "0" a (Cons "1" b Nil))
Expand Down Expand Up @@ -112,31 +109,32 @@ foreign import t7_ :: forall a b c d e f g . Fn7 a b c d e f g (T7 a b c d e
foreign import t8_ :: forall a b c d e f g h . Fn8 a b c d e f g h (T8 a b c d e f g h)
foreign import t9_ :: forall a b c d e f g h i. Fn9 a b c d e f g h i (T9 a b c d e f g h i)

class TupleSize n (t :: RowList) | t -> n
class TupleSize :: forall k. k -> RowList Type -> Constraint
class TupleSize n (t :: RowList Type) | t -> n

instance tupleSizeT2 :: TupleSize D2 (Cons "0" a (Cons "1" b Nil))
instance tupleSizeT3 :: TupleSize D3 (Cons "0" a (Cons "1" b (Cons "2" c Nil)))
instance tupleSizeT4 :: TupleSize D4 (Cons "0" a (Cons "1" b (Cons "2" c (Cons "3" d Nil))))
instance tupleSizeT5 :: TupleSize D5 (Cons "0" a (Cons "1" b (Cons "2" c (Cons "3" d (Cons "4" e Nil)))))
instance tupleSizeT6 :: TupleSize D6 (Cons "0" a (Cons "1" b (Cons "2" c (Cons "3" d (Cons "4" e (Cons "5" f Nil))))))
instance tupleSizeT7 :: TupleSize D7 (Cons "0" a (Cons "1" b (Cons "2" c (Cons "3" d (Cons "4" e (Cons "5" f (Cons "6" g Nil)))))))
instance tupleSizeT8 :: TupleSize D8 (Cons "0" a (Cons "1" b (Cons "2" c (Cons "3" d (Cons "4" e (Cons "5" f (Cons "6" g (Cons "7" h Nil))))))))
instance tupleSizeT9 :: TupleSize D9 (Cons "0" a (Cons "1" b (Cons "2" c (Cons "3" d (Cons "4" e (Cons "5" f (Cons "6" g (Cons "7" h (Cons "8" i Nil)))))))))
instance TupleSize D2 (Cons "0" a (Cons "1" b Nil))
instance TupleSize D3 (Cons "0" a (Cons "1" b (Cons "2" c Nil)))
instance TupleSize D4 (Cons "0" a (Cons "1" b (Cons "2" c (Cons "3" d Nil))))
instance TupleSize D5 (Cons "0" a (Cons "1" b (Cons "2" c (Cons "3" d (Cons "4" e Nil)))))
instance TupleSize D6 (Cons "0" a (Cons "1" b (Cons "2" c (Cons "3" d (Cons "4" e (Cons "5" f Nil))))))
instance TupleSize D7 (Cons "0" a (Cons "1" b (Cons "2" c (Cons "3" d (Cons "4" e (Cons "5" f (Cons "6" g Nil)))))))
instance TupleSize D8 (Cons "0" a (Cons "1" b (Cons "2" c (Cons "3" d (Cons "4" e (Cons "5" f (Cons "6" g (Cons "7" h Nil))))))))
instance TupleSize D9 (Cons "0" a (Cons "1" b (Cons "2" c (Cons "3" d (Cons "4" e (Cons "5" f (Cons "6" g (Cons "7" h (Cons "8" i Nil)))))))))


instance genericTuple2 :: Generic
instance Generic
(TupleN (Cons "0" a (Cons "1" b Nil)))
(Constructor "t2" (Product (Argument a) (Argument b))) where
to (Constructor (Product (Argument a) (Argument b))) = runFn2 t2_ a b
from xs = Constructor (Product (Argument (prj d0 xs)) (Argument (prj d1 xs)))

instance genericTuple3 :: Generic
instance Generic
(TupleN (Cons "0" a (Cons "1" b (Cons "2" c Nil))))
(Constructor "t3" (Product (Argument a) (Product (Argument b) (Argument c)))) where
to (Constructor (Product (Argument a) (Product (Argument b) (Argument c)))) = runFn3 t3_ a b c
from xs = Constructor $ Product (Argument (prj d0 xs)) $ Product (Argument (prj d1 xs)) (Argument (prj d2 xs))

instance genericTuple4 :: Generic
instance Generic
(TupleN (Cons "0" a
(Cons "1" b
(Cons "2" c
Expand All @@ -154,7 +152,7 @@ instance genericTuple4 :: Generic
$ Product (Argument (prj d2 xs))
(Argument (prj d3 xs))

instance genericTuple5 :: Generic
instance Generic
(TupleN (Cons "0" a
(Cons "1" b
(Cons "2" c
Expand All @@ -176,7 +174,7 @@ instance genericTuple5 :: Generic
$ Product (Argument (prj d3 xs))
(Argument (prj d4 xs))

instance genericTuple6 :: Generic
instance Generic
(TupleN (Cons "0" a
(Cons "1" b
(Cons "2" c
Expand All @@ -202,7 +200,7 @@ instance genericTuple6 :: Generic
$ Product (Argument (prj d4 xs))
(Argument (prj d5 xs))

instance genericTuple7 :: Generic
instance Generic
(TupleN (Cons "0" a
(Cons "1" b
(Cons "2" c
Expand Down Expand Up @@ -232,7 +230,7 @@ instance genericTuple7 :: Generic
$ Product (Argument (prj d5 xs))
(Argument (prj d6 xs))

instance genericTuple8 :: Generic
instance Generic
(TupleN (Cons "0" a
(Cons "1" b
(Cons "2" c
Expand Down Expand Up @@ -266,7 +264,7 @@ instance genericTuple8 :: Generic
$ Product (Argument (prj d6 xs))
(Argument (prj d7 xs))

instance genericTuple9 :: Generic
instance Generic
(TupleN (Cons "0" a
(Cons "1" b
(Cons "2" c
Expand Down Expand Up @@ -307,12 +305,12 @@ instance genericTuple9 :: Generic

class ShowNat n (s :: Symbol) | n -> s, s -> n

instance showNatD0 :: ShowNat D0 "0"
instance showNatD1 :: ShowNat D1 "1"
instance showNatD2 :: ShowNat D2 "2"
instance showNatD3 :: ShowNat D3 "3"
instance showNatD4 :: ShowNat D4 "4"
instance showNatD5 :: ShowNat D5 "5"
instance showNatD6 :: ShowNat D6 "6"
instance showNatD7 :: ShowNat D7 "7"
instance showNatD8 :: ShowNat D8 "8"
instance ShowNat D0 "0"
instance ShowNat D1 "1"
instance ShowNat D2 "2"
instance ShowNat D3 "3"
instance ShowNat D4 "4"
instance ShowNat D5 "5"
instance ShowNat D6 "6"
instance ShowNat D7 "7"
instance ShowNat D8 "8"