git.iko.soy/purescript-literals
on 0a7553e help sign in
12 files changed+72−101
since splitsnapshots
unifiedsplit
LICENSE−21 bower.json+28−25 packages.dhall+3−2 spago.dhall+20−15 src/Literals.purs+1 src/Literals/Int.purs+4−5 src/Literals/Null.js+1−1 src/Literals/Null.purs+2−14 src/Literals/Number.purs+6−5 src/Literals/String.purs+4−3 src/Literals/Undefined.js+1−1 src/Literals/Undefined.purs+2−9
LICENSEdeleted−21
@@ -1,21 +0,0 @@
1−MIT License
2−
3−Copyright (c) 2020 Jan Vincent Liwanag
4−
5−Permission is hereby granted, free of charge, to any person obtaining a copy
6−of this software and associated documentation files (the "Software"), to deal
7−in the Software without restriction, including without limitation the rights
8−to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9−copies of the Software, and to permit persons to whom the Software is
10−furnished to do so, subject to the following conditions:
11−
12−The above copyright notice and this permission notice shall be included in all
13−copies or substantial portions of the Software.
14−
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,
17−FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18−AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19−LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20−OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21−SOFTWARE.
bower.json+28−25
@@ -1,27 +1,30 @@
11{
2− "name": "purescript-literals",
3− "license": [
4− "MIT"
5− ],
6− "repository": {
7− "type": "git",
8− "url": "https://github.com/rowtype-yoga/purescript-literals.git"
9− },
10− "ignore": [
11− "**/.*",
12− "node_modules",
13− "bower_components",
14− "output"
15− ],
16− "dependencies": {
17− "purescript-assert": "^v6.0.0",
18− "purescript-effect": "^v4.0.0",
19− "purescript-integers": "^v6.0.0",
20− "purescript-maybe": "^v6.0.0",
21− "purescript-numbers": "^v9.0.0",
22− "purescript-partial": "^v4.0.0",
23− "purescript-prelude": "^v6.0.0",
24− "purescript-typelevel-prelude": "^v7.0.0",
25− "purescript-unsafe-coerce": "^v6.0.0"
26− }
2+ "name": "purescript-literals",
3+ "homepage": "https://github.com/jvliwanag/purescript-literal",
4+ "authors": [
5+ "Jan Vincent Liwanag <jvliwanag@gmail.com>"
6+ ],
7+ "description": "A Symbol Proxy having a runtime value equal to the reflected symbol",
8+ "main": "",
9+ "license": "MIT",
10+ "repository": {
11+ "type": "git",
12+ "url": "https://github.com/jvliwanag/purescript-literals.git"
13+ },
14+ "ignore": [
15+ "**/.*",
16+ "node_modules",
17+ "bower_components",
18+ "test",
19+ "tests"
20+ ],
21+ "dependencies": {
22+ "purescript-unsafe-coerce": "^4.0.0",
23+ "purescript-prelude": "^4.1.1",
24+ "purescript-maybe": "^4.0.1",
25+ "purescript-integers": "^4.0.0",
26+ "purescript-typelevel-prelude": "^5.0.2",
27+ "purescript-partial": "^2.0.1",
28+ "purescript-numbers": "^7.0.0"
29+ }
2730}
packages.dhall+3−2
@@ -116,9 +116,10 @@ let additions =
116116 }
117117-------------------------------
118118-}
119+
120+
119121let upstream =
120− https://github.com/purescript/package-sets/releases/download/psc-0.15.2-20220530/packages.dhall
121− sha256:15dd8041480502850e4043ea2977ed22d6ab3fc24d565211acde6f8c5152a799
122+ https://github.com/purescript/package-sets/releases/download/psc-0.13.4-20191110/packages.dhall sha256:563a7f694e18e6399f7f6d01f5b7e3c3345781655d99945768f48e458feb93a4
122123
123124let overrides = {=}
124125
spago.dhall+20−15
@@ -1,17 +1,22 @@
1−{ name = "literals"
2−, license = "MIT"
3−, repository = "https://github.com/rowtype-yoga/purescript-literals.git"
1+{-
2+Welcome to a Spago project!
3+You can edit this file as you like.
4+-}
5+{ name =
6+ "literal"
47, dependencies =
5− [ "assert"
6− , "effect"
7− , "integers"
8− , "maybe"
9− , "numbers"
10− , "partial"
11− , "prelude"
12− , "typelevel-prelude"
13− , "unsafe-coerce"
14− ]
15−, packages = ./packages.dhall
16−, sources = [ "src/**/*.purs", "test/**/*.purs" ]
8+ [ "assert"
9+ , "effect"
10+ , "console"
11+ , "integers"
12+ , "numbers"
13+ , "partial"
14+ , "psci-support"
15+ , "unsafe-coerce"
16+ , "typelevel-prelude"
17+ ]
18+, packages =
19+ ./packages.dhall
20+, sources =
21+ [ "src/**/*.purs", "test/**/*.purs" ]
1722}
src/Literals.purs+1
@@ -11,3 +11,4 @@ import Literals.Int (class Digit, class Int, class Int', IntLit, intLit) as Int
1111import Literals.Literal (Literal, toValue) as Literal
1212import Literals.Number (class Number, class Number', NumberLit, numberLit) as Number
1313import Literals.String (StringLit, stringLit) as String
14+
src/Literals/Int.purs+4−5
@@ -6,7 +6,7 @@ module Literals.Int
66 , class Int
77 , class Int'
88 , intLit
9− , IntPart
9+ , kind IntPart
1010 ) where
1111
1212import Prelude
@@ -17,8 +17,7 @@ import Data.Symbol (class IsSymbol)
1717import Literals.Literal (Literal)
1818import Partial.Unsafe (unsafePartial)
1919import Prim.Symbol (class Cons)
20−import Type.Prelude (reflectSymbol)
21−import Type.Proxy (Proxy(..))
20+import Type.Prelude (SProxy(..), reflectSymbol)
2221import Unsafe.Coerce (unsafeCoerce)
2322
2423class Digit (s :: Symbol)
@@ -34,7 +33,7 @@ else instance digit7 :: Digit "7"
3433else instance digit8 :: Digit "8"
3534else instance digit9 :: Digit "9"
3635
37−data IntPart
36+foreign import kind IntPart
3837foreign import data Sign :: IntPart
3938foreign import data IntegerPart :: IntPart
4039
@@ -51,4 +50,4 @@ else instance digitIntegerPart :: (Digit h, Cons h' t' t, Int' h' t' IntegerPart
5150type IntLit sym = Literal Int sym
5251
5352intLit :: forall sym. IsSymbol sym => Int sym => IntLit sym
54−intLit = unsafeCoerce $ unsafePartial $ fromJust $ fromString $ reflectSymbol (Proxy :: Proxy sym)
53+intLit = unsafeCoerce $ unsafePartial $ fromJust $ fromString $ reflectSymbol (SProxy :: SProxy sym)
src/Literals/Null.js+1−1
@@ -1 +1 @@
1−export _null = null;
1+exports.null = null;
src/Literals/Null.purs+2−14
@@ -1,17 +1,5 @@
1−module Literals.Null
2− ( Null
3− , null
4− )
5−where
6−
7−import Prelude
1+module Literals.Null where
82
93foreign import data Null :: Type
104
11−foreign import _null :: Null
12−
13−null :: Null
14−null = _null
15−
16−instance showNull :: Show Null where
17− show _ = "null"
5+foreign import null :: Null
src/Literals/Number.purs+6−5
@@ -5,7 +5,7 @@ module Literals.Number
55 , Sign
66 , class Number
77 , class Number'
8− , NumberPart
8+ , kind NumberPart
99 , numberLit
1010 ) where
1111
@@ -13,19 +13,19 @@ import Prelude
1313
1414import Data.Maybe (fromJust)
1515import Data.Number (fromString)
16−import Data.Symbol (class IsSymbol)
16+import Data.Symbol (class IsSymbol, SProxy(..))
1717import Literals.Int (class Digit)
1818import Literals.Literal (Literal)
1919import Partial.Unsafe (unsafePartial)
2020import Prim.Symbol (class Cons)
21−import Type.Prelude (reflectSymbol, Proxy(..))
21+import Type.Prelude (reflectSymbol)
2222import Unsafe.Coerce (unsafeCoerce)
2323
2424class Number (sym :: Symbol)
2525
2626instance numberInstance :: (Number' h t Sign, Cons h t s) => Number s
2727
28−data NumberPart
28+foreign import kind NumberPart
2929foreign import data Sign :: NumberPart
3030foreign import data IntegerPart :: NumberPart
3131foreign import data FractionalPart :: NumberPart
@@ -42,4 +42,5 @@ else instance digitFractionalPart :: (Digit h, Cons h' t' t, Number' h' t' Fract
4242type NumberLit sym = Literal Number sym
4343
4444numberLit :: forall sym. IsSymbol sym => Number sym => NumberLit sym
45−numberLit = unsafeCoerce $ unsafePartial $ fromJust $ fromString $ reflectSymbol (Proxy :: Proxy sym)
45+numberLit = unsafeCoerce $ unsafePartial $ fromJust $ fromString $ reflectSymbol (SProxy :: SProxy sym)
46+
src/Literals/String.purs+4−3
@@ -3,12 +3,13 @@ module Literals.String
33 , StringLit
44 ) where
55
6−import Data.Symbol (class IsSymbol, reflectSymbol)
7−import Type.Proxy (Proxy(..))
6+import Data.Symbol (class IsSymbol, SProxy(..), reflectSymbol)
87import Literals.Literal (Literal)
98import Unsafe.Coerce (unsafeCoerce)
109
1110type StringLit sym = Literal String sym
1211
1312stringLit :: forall sym. IsSymbol sym => StringLit sym
14−stringLit = unsafeCoerce (reflectSymbol (Proxy :: Proxy sym))
13+stringLit = unsafeCoerce (reflectSymbol (SProxy :: SProxy sym))
14+
15+
src/Literals/Undefined.js+1−1
@@ -1 +1 @@
1−export const _undefined = undefined;
1+exports.undefined = undefined;
src/Literals/Undefined.purs+2−9
@@ -1,17 +1,10 @@
1−module Literals.Undefined
2− ( Undefined
3− , undefined
4− )
5−where
1+module Literals.Undefined where
62
73import Prelude
84
95foreign import data Undefined :: Type
106
11−foreign import _undefined :: Undefined
12−
13−undefined :: Undefined
14−undefined = _undefined
7+foreign import undefined :: Undefined
158
169instance undefinedEq :: Eq Undefined where
1710 eq _ _ = true