git.iko.soy/purescript-literals
on main help sign in
bower.jsonnew file+27
since splitsnapshots
unifiedsplit
@@ -0,0 +1,27 @@
1+{
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+ }
27+}
packages.dhall+2−3
@@ -116,10 +116,9 @@ let additions =
116 }
116 }
117-------------------------------
117-------------------------------
118-}
118-}
119−
120−
121let upstream =
119let upstream =
122− https://github.com/purescript/package-sets/releases/download/psc-0.13.4-20191110/packages.dhall sha256:563a7f694e18e6399f7f6d01f5b7e3c3345781655d99945768f48e458feb93a4
120+ https://github.com/purescript/package-sets/releases/download/psc-0.15.2-20220530/packages.dhall
121+ sha256:15dd8041480502850e4043ea2977ed22d6ab3fc24d565211acde6f8c5152a799
123
122
124let overrides = {=}
123let overrides = {=}
125
124
spago.dhall+15−20
@@ -1,22 +1,17 @@
1−{-
2−Welcome to a Spago project!
3−You can edit this file as you like.
4−-}
5−{ name =
1+{ name = "literals"
6− "literal"
2+, license = "MIT"
3+, repository = "https://github.com/rowtype-yoga/purescript-literals.git"
7, dependencies =
4, dependencies =
8− [ "assert"
5+ [ "assert"
9− , "effect"
6+ , "effect"
10− , "console"
11− , "integers"
7+ , "integers"
8+ , "maybe"
12− , "numbers"
9+ , "numbers"
13− , "partial"
10+ , "partial"
14− , "psci-support"
11+ , "prelude"
12+ , "typelevel-prelude"
15− , "unsafe-coerce"
13+ , "unsafe-coerce"
16− , "typelevel-prelude"
17− ]
14+ ]
18−, packages =
19− ./packages.dhall
15+, packages = ./packages.dhall
20−, sources =
21− [ "src/**/*.purs", "test/**/*.purs" ]
16+, sources = [ "src/**/*.purs", "test/**/*.purs" ]
22}
17}
src/Literals.purs−1
@@ -11,4 +11,3 @@ import Literals.Int (class Digit, class Int, class Int', IntLit, intLit) as Int
11import Literals.Literal (Literal, toValue) as Literal
11import Literals.Literal (Literal, toValue) as Literal
12import Literals.Number (class Number, class Number', NumberLit, numberLit) as Number
12import Literals.Number (class Number, class Number', NumberLit, numberLit) as Number
13import Literals.String (StringLit, stringLit) as String
13import Literals.String (StringLit, stringLit) as String
14−
src/Literals/Int.purs+5−4
@@ -6,7 +6,7 @@ module Literals.Int
6 , class Int
6 , class Int
7 , class Int'
7 , class Int'
8 , intLit
8 , intLit
9− , kind IntPart
9+ , IntPart
10 ) where
10 ) where
11
11
12import Prelude
12import Prelude
@@ -17,7 +17,8 @@ import Data.Symbol (class IsSymbol)
17import Literals.Literal (Literal)
17import Literals.Literal (Literal)
18import Partial.Unsafe (unsafePartial)
18import Partial.Unsafe (unsafePartial)
19import Prim.Symbol (class Cons)
19import Prim.Symbol (class Cons)
20−import Type.Prelude (SProxy(..), reflectSymbol)
20+import Type.Prelude (reflectSymbol)
21+import Type.Proxy (Proxy(..))
21import Unsafe.Coerce (unsafeCoerce)
22import Unsafe.Coerce (unsafeCoerce)
22
23
23class Digit (s :: Symbol)
24class Digit (s :: Symbol)
@@ -33,7 +34,7 @@ else instance digit7 :: Digit "7"
33else instance digit8 :: Digit "8"
34else instance digit8 :: Digit "8"
34else instance digit9 :: Digit "9"
35else instance digit9 :: Digit "9"
35
36
36−foreign import kind IntPart
37+data IntPart
37foreign import data Sign :: IntPart
38foreign import data Sign :: IntPart
38foreign import data IntegerPart :: IntPart
39foreign import data IntegerPart :: IntPart
39
40
@@ -50,4 +51,4 @@ else instance digitIntegerPart :: (Digit h, Cons h' t' t, Int' h' t' IntegerPart
50type IntLit sym = Literal Int sym
51type IntLit sym = Literal Int sym
51
52
52intLit :: forall sym. IsSymbol sym => Int sym => IntLit sym
53intLit :: forall sym. IsSymbol sym => Int sym => IntLit sym
53−intLit = unsafeCoerce $ unsafePartial $ fromJust $ fromString $ reflectSymbol (SProxy :: SProxy sym)
54+intLit = unsafeCoerce $ unsafePartial $ fromJust $ fromString $ reflectSymbol (Proxy :: Proxy sym)
src/Literals/Null.js+1−1
@@ -1 +1 @@
1−exports.null = null;
1+export _null = null;
src/Literals/Null.purs+14−2
@@ -1,5 +1,17 @@
1−module Literals.Null where
1+module Literals.Null
2+ ( Null
3+ , null
4+ )
5+where
6+
7+import Prelude
2
8
3foreign import data Null :: Type
9foreign import data Null :: Type
4
10
5−foreign import null :: Null
11+foreign import _null :: Null
12+
13+null :: Null
14+null = _null
15+
16+instance showNull :: Show Null where
17+ show _ = "null"
src/Literals/Number.purs+5−6
@@ -5,7 +5,7 @@ module Literals.Number
5 , Sign
5 , Sign
6 , class Number
6 , class Number
7 , class Number'
7 , class Number'
8− , kind NumberPart
8+ , NumberPart
9 , numberLit
9 , numberLit
10 ) where
10 ) where
11
11
@@ -13,19 +13,19 @@ import Prelude
13
13
14import Data.Maybe (fromJust)
14import Data.Maybe (fromJust)
15import Data.Number (fromString)
15import Data.Number (fromString)
16−import Data.Symbol (class IsSymbol, SProxy(..))
16+import Data.Symbol (class IsSymbol)
17import Literals.Int (class Digit)
17import Literals.Int (class Digit)
18import Literals.Literal (Literal)
18import Literals.Literal (Literal)
19import Partial.Unsafe (unsafePartial)
19import Partial.Unsafe (unsafePartial)
20import Prim.Symbol (class Cons)
20import Prim.Symbol (class Cons)
21−import Type.Prelude (reflectSymbol)
21+import Type.Prelude (reflectSymbol, Proxy(..))
22import Unsafe.Coerce (unsafeCoerce)
22import Unsafe.Coerce (unsafeCoerce)
23
23
24class Number (sym :: Symbol)
24class Number (sym :: Symbol)
25
25
26instance numberInstance :: (Number' h t Sign, Cons h t s) => Number s
26instance numberInstance :: (Number' h t Sign, Cons h t s) => Number s
27
27
28−foreign import kind NumberPart
28+data NumberPart
29foreign import data Sign :: NumberPart
29foreign import data Sign :: NumberPart
30foreign import data IntegerPart :: NumberPart
30foreign import data IntegerPart :: NumberPart
31foreign import data FractionalPart :: NumberPart
31foreign import data FractionalPart :: NumberPart
@@ -42,5 +42,4 @@ else instance digitFractionalPart :: (Digit h, Cons h' t' t, Number' h' t' Fract
42type NumberLit sym = Literal Number sym
42type NumberLit sym = Literal Number sym
43
43
44numberLit :: forall sym. IsSymbol sym => Number sym => NumberLit sym
44numberLit :: forall sym. IsSymbol sym => Number sym => NumberLit sym
45−numberLit = unsafeCoerce $ unsafePartial $ fromJust $ fromString $ reflectSymbol (SProxy :: SProxy sym)
45+numberLit = unsafeCoerce $ unsafePartial $ fromJust $ fromString $ reflectSymbol (Proxy :: Proxy sym)
46−
src/Literals/String.purs+3−4
@@ -3,13 +3,12 @@ module Literals.String
3 , StringLit
3 , StringLit
4 ) where
4 ) where
5
5
6−import Data.Symbol (class IsSymbol, SProxy(..), reflectSymbol)
6+import Data.Symbol (class IsSymbol, reflectSymbol)
7+import Type.Proxy (Proxy(..))
7import Literals.Literal (Literal)
8import Literals.Literal (Literal)
8import Unsafe.Coerce (unsafeCoerce)
9import Unsafe.Coerce (unsafeCoerce)
9
10
10type StringLit sym = Literal String sym
11type StringLit sym = Literal String sym
11
12
12stringLit :: forall sym. IsSymbol sym => StringLit sym
13stringLit :: forall sym. IsSymbol sym => StringLit sym
13−stringLit = unsafeCoerce (reflectSymbol (SProxy :: SProxy sym))
14+stringLit = unsafeCoerce (reflectSymbol (Proxy :: Proxy sym))
14−
15−
src/Literals/Undefined.js+1−1
@@ -1 +1 @@
1−exports.undefined = undefined;
1+export const _undefined = undefined;
src/Literals/Undefined.purs+9−2
@@ -1,10 +1,17 @@
1−module Literals.Undefined where
1+module Literals.Undefined
2+ ( Undefined
3+ , undefined
4+ )
5+where
2
6
3import Prelude
7import Prelude
4
8
5foreign import data Undefined :: Type
9foreign import data Undefined :: Type
6
10
11+foreign import _undefined :: Undefined
12+
7−foreign import undefined :: Undefined
13+undefined :: Undefined
14+undefined = _undefined
8
15
9instance undefinedEq :: Eq Undefined where
16instance undefinedEq :: Eq Undefined where
10 eq _ _ = true
17 eq _ _ = true