Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
148
Issues
148
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
6ffee35a
Commit
6ffee35a
authored
Jul 17, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIXME] removing point-free
parent
4127580b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
Crypto.purs
src/Gargantext/Utils/Crypto.purs
+6
-9
No files found.
src/Gargantext/Utils/Crypto.purs
View file @
6ffee35a
...
...
@@ -14,7 +14,7 @@ type Hash = String
-- | Main exposed api
hash :: forall a. IsHashable a => a -> String
hash
= toString <<< hash''
hash
x = toString (hash'' x)
-- | Newtype HashDone is needed to disambiguate Set String and Set HashDone
-- Set String needs Set.map hash
...
...
@@ -32,7 +32,7 @@ instance eqHashDone :: Eq HashDone where
------------------------------------------------------------------------
hash' :: forall a. Crypto.Hashable a => a -> HashDone
hash'
= HashDone <<< Crypto.toString <<< Crypto.hash Crypto.SHA256
hash'
x = HashDone $ Crypto.toString $ Crypto.hash Crypto.SHA256 x
class IsHashable a where
hash'' :: a -> HashDone
...
...
@@ -44,14 +44,14 @@ instance isHashableString :: IsHashable String
------------------------------------------------------------------------
instance isHashableArrayHashDone :: IsHashable (Array HashDone)
where
hash''
= hash'' <<< Set.fromFoldable
hash''
x = hash'' $ Set.fromFoldable x
else instance isHashableArray :: (Crypto.Hashable a, IsHashable a) => IsHashable (Array a)
where
hash''
= hash'' <<< map hash
hash''
x = hash'' $ map hash x
------------------------------------------------------------------------
instance isHashableSetHashDone :: IsHashable (Set HashDone) where
hash''
= hash'' <<< concat <<< map toString <<< toArray
hash''
x = hash'' $ concat $ map toString $ toArray x
where
toArray :: forall a. Set a -> Array a
toArray = Set.toUnfoldable
...
...
@@ -60,9 +60,6 @@ instance isHashableSetHashDone :: IsHashable (Set HashDone) where
concat = Array.foldl (<>) ""
else instance isHashableSet :: (Crypto.Hashable a, IsHashable a) => IsHashable (Set a)
where
hash'' = hash'' <<< Set.map hash''
hash'' x = hash'' $ Set.map hash'' x
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment