Commit a6983240 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[purescript] upgrade to 0.15, first draft

parent 9de858ae
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -5,8 +5,8 @@ import
pkgs.fetchFromGitHub {
owner = "justinwoo";
repo = "easy-purescript-nix";
rev = "9c5ffd3e54c41dece66ed84f8f23970a4f1f3883";
sha256 = "8erFzbiRJYqPgJHuQwhgBPltQeaWeAZom/5X3lyUAcc=";
rev = "0ad5775c1e80cdd952527db2da969982e39ff592";
sha256 = "bwbpXSTD8Hf7tlCXfZuLfo2QivvX1ZDJ1PijXXRTo3Q=";
}
) {
inherit pkgs;
......
let upstream =
https://github.com/purescript/package-sets/releases/download/psc-0.14.7-20220404/packages.dhall sha256:75d0f0719f32456e6bdc3efd41cfc64785655d2b751e3d080bd849033ed053f2
https://github.com/purescript/package-sets/releases/download/psc-0.15.0-20220506/packages.dhall sha256:f83b68ff07cf6557e82379e749118e6ff11eecc6be5754540aae855cd1e46917
let overrides =
{ globals =
......@@ -110,15 +110,23 @@ let additions =
}
, ffi-simple =
{ dependencies =
[ "prelude"
[ "aff"
, "arrays"
, "effect"
, "maybe"
, "foldable-traversable"
, "functions"
, "maybe"
, "nullable"
, "prelude"
, "psci-support"
, "refs"
, "spec"
, "tuples"
, "unsafe-coerce"
, "unsafe-reference"
]
, repo = "https://github.com/irresponsible/purescript-ffi-simple"
, version = "v0.2.10"
, version = "v0.3.0"
}
, dom-simple =
{ dependencies =
......@@ -221,7 +229,7 @@ let additions =
, version = "v2.2.0"
}
, uint =
{ dependencies = [ "maybe", "math" ]
{ dependencies = [ "maybe" ]
, repo = "https://github.com/zaquest/purescript-uint"
, version = "v5.1.1"
}
......
......@@ -20,10 +20,13 @@ let
echo "Compiling"
#build-purs
spago build
echo "Bundling"
#spago build
#echo "Bundling"
#pulp browserify --skip-compile -t dist/bundle.js --src-path output
browserify
#browserify
# 0.15
spago bundle-app --main Main --to dist/bundle.js
'';
......@@ -105,7 +108,7 @@ let
in
pkgs.mkShell {
buildInputs = [
easy-ps.purs-0_14_7
easy-ps.purs-0_15_0
easy-ps.psc-package
easy-ps.dhall-json-simple
easy-ps.zephyr
......
......@@ -49,7 +49,6 @@ to generate this file without the comments in this block.
, "lists"
, "markdown"
, "markdown-smolder"
, "math"
, "maybe"
, "media-types"
, "milkis"
......
......@@ -9,6 +9,7 @@ import Data.Int (toNumber)
import Data.Map as Map
import Data.Maybe (Maybe(..), fromJust)
import Data.Nullable (null, Nullable)
import Data.Number as DN
import Data.Sequence as Seq
import Data.Set as Set
import Data.Tuple (Tuple(..))
......@@ -33,7 +34,6 @@ import Gargantext.Types as Types
import Gargantext.Utils ((?))
import Gargantext.Utils.Range as Range
import Gargantext.Utils.Reactix as R2
import Math as Math
import Partial.Unsafe (unsafePartial)
import Reactix as R
import Reactix.DOM.HTML as H
......@@ -287,7 +287,7 @@ convert (GET.GraphData r) = Tuple r.metaData $ SigmaxT.Graph {nodes, edges}
, hidden : false
, id : n.id_
, label : n.label
, size : Math.log (toNumber n.size + 1.0)
, size : DN.log (toNumber n.size + 1.0)
, type : modeGraphType gargType
, x : n.x -- cos (toNumber i)
, y : n.y -- sin (toNumber i)
......
......@@ -13,6 +13,7 @@ import Data.Foldable as F
import Data.Int (fromString)
import Data.Map as Map
import Data.Maybe (Maybe(..), fromJust)
import Data.Number as DN
import Data.Sequence as Seq
import Data.Set as Set
import Data.Tuple.Nested ((/\))
......@@ -38,7 +39,6 @@ import Gargantext.Types (CTabNgramType, FrontendError(..), NodeID, TabSubType(..
import Gargantext.Utils (nbsp)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Math as Math
import Partial.Unsafe (unsafePartial)
import Reactix as R
import Reactix.DOM.HTML as H
......@@ -359,9 +359,9 @@ neighborhoodCpt = R.memo' $ here.component "neighborhood" cpt where
-- Computed
let
minSize = F.foldl Math.min 0.0 (Seq.map _.size (SigmaxT.graphNodes graph'))
minSize = F.foldl DN.min 0.0 (Seq.map _.size (SigmaxT.graphNodes graph'))
maxSize = F.foldl Math.max 0.0 (Seq.map _.size (SigmaxT.graphNodes graph'))
maxSize = F.foldl DN.max 0.0 (Seq.map _.size (SigmaxT.graphNodes graph'))
maxTruncateResult = 5
......@@ -522,7 +522,7 @@ badgeSize minSize maxSize size =
minFontSize = 10.0
maxFontSize = 24.0
sizeScaled = (size - minSize) / (maxSize - minSize) -- in [0; 1] range
scale' = Math.log (sizeScaled + 1.0) / (Math.log 2.0) -- in [0; 1] range
scale' = DN.log (sizeScaled + 1.0) / (DN.log 2.0) -- in [0; 1] range
scale = minFontSize + scale' * (maxFontSize - minFontSize)
in
......
......@@ -42,7 +42,6 @@ import Gargantext.Types (CTabNgramType, FrontendError(..), NodeID, TabSubType(..
import Gargantext.Utils (getter, nbsp)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Math as Math
import Partial.Unsafe (unsafePartial)
import Reactix as R
import Reactix.DOM.HTML as H
......
......@@ -10,6 +10,7 @@ import Data.Generic.Rep (class Generic)
import Data.Eq.Generic (genericEq)
import Data.Int (fromNumber)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Number as DN
import Data.Nullable (Nullable, null)
import Data.Traversable (traverse_)
import DOM.Simple as DOM
......@@ -19,7 +20,6 @@ import DOM.Simple.EventListener as EL
import DOM.Simple (DOMRect)
import Global (toFixed)
import Effect (Effect)
import Math as M
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
......@@ -65,7 +65,7 @@ rangeSliderCpt = here.component "rangeSlider" cpt
where
cpt props _ = do
-- rounding precision (i.e. how many decimal digits are in epsilon)
let precision = fromMaybe 0 $ fromNumber $ max 0.0 $ - M.floor $ (M.log props.epsilon) / M.ln10
let precision = fromMaybe 0 $ fromNumber $ max 0.0 $ - DN.floor $ (DN.log props.epsilon) / DN.ln10
-- scale bar
scaleElem <- (R.useRef null) :: R.Hooks (R.Ref (Nullable DOM.Element)) -- dom ref
......
......@@ -11,7 +11,6 @@ import Data.Maybe (Maybe(..))
import Data.Ord as Ord
import Effect (Effect)
import Effect.Uncurried (EffectFn2, runEffectFn2)
import Math as Math
import Gargantext.Prelude
......@@ -37,4 +36,4 @@ min xs = foldr reducer (A.head xs) xs
range :: Int -> Int -> Int -> Array Int
range start end step = map (\i -> start + i*step) $ A.range 0 end'
where
end' = DI.round $ Math.floor $ (DI.toNumber $ end - start) / (DI.toNumber step)
end' = DI.round $ DI.floor $ (DI.toNumber $ end - start) / (DI.toNumber step)
module Gargantext.Utils.Math where
import Data.Number as DN
import Prelude
import Math as Math
roundToMultiple :: Number -> Number -> Number
roundToMultiple eps num = eps * Math.round (num / eps)
roundToMultiple eps num = eps * DN.round (num / eps)
-- | Logarithm with given base
logb :: Number -> Number -> Number
logb base n = (Math.log n) / (Math.log base)
logb base n = (DN.log n) / (DN.log base)
log10 :: Number -> Number
log10 = logb 10.0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment