Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext-prelude
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
haskell-gargantext-prelude
Commits
986a7aa9
Commit
986a7aa9
authored
Dec 04, 2023
by
Alfredo Di Napoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Warning-free compilation
parent
e7b5aff0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
20 deletions
+13
-20
User.hs
src/Gargantext/Prelude/Crypto/Pass/User.hs
+5
-6
Mail.hs
src/Gargantext/Prelude/Mail.hs
+4
-5
NLP.hs
src/Gargantext/Prelude/NLP.hs
+4
-9
No files found.
src/Gargantext/Prelude/Crypto/Pass/User.hs
View file @
986a7aa9
...
@@ -18,7 +18,6 @@ module Gargantext.Prelude.Crypto.Pass.User
...
@@ -18,7 +18,6 @@ module Gargantext.Prelude.Crypto.Pass.User
-- 1) Quick password generator imports
-- 1) Quick password generator imports
import
Data.Text
(
Text
)
import
Data.String
(
String
)
import
Data.String
(
String
)
import
Control.Monad
import
Control.Monad
import
Control.Monad.Random
import
Control.Monad.Random
...
@@ -72,17 +71,17 @@ gargPassUserEasy n = gargPassUserEasy' (100 * fromIntegral n) n
...
@@ -72,17 +71,17 @@ gargPassUserEasy n = gargPassUserEasy' (100 * fromIntegral n) n
gargPassUserEasy'
::
(
Num
a
,
Enum
a
)
=>
Int
->
a
->
[
b
]
->
IO
[
b
]
gargPassUserEasy'
::
(
Num
a
,
Enum
a
)
=>
Int
->
a
->
[
b
]
->
IO
[
b
]
gargPassUserEasy'
threshold
size
wlist
gargPassUserEasy'
threshold
size
wlist
|
length
wlist
>
threshold
=
generatePassword
size
wlist
|
length
wlist
>
threshold
=
generatePassword
size
wlist
|
otherwise
=
panic
"List to short"
|
otherwise
=
panic
Trace
"List to short"
generatePassword
::
(
Num
a
,
Enum
a
)
=>
a
->
[
b
]
->
IO
[
b
]
generatePassword
::
(
Num
a
,
Enum
a
)
=>
a
->
[
b
]
->
IO
[
b
]
generatePassword
size
wlist
=
shuffle
wlist
generatePassword
size
wlist
=
shuffle
wlist
>>=
\
wlist'
->
mapM
(
\
_
->
getRandomElement
wlist'
)
[
1
..
size
]
>>=
\
wlist'
->
mapM
(
\
_
->
getRandomElement
wlist'
)
[
1
..
size
]
getRandomIndex
::
Foldable
t
=>
t
a
->
IO
Int
getRandomIndex
::
Foldable
t
=>
t
a
->
IO
Int
getRandomIndex
list
=
randomRIO
(
0
,
(
length
list
-
1
))
getRandomIndex
xs
=
randomRIO
(
0
,
(
length
xs
-
1
))
getRandomElement
::
[
b
]
->
IO
b
getRandomElement
::
[
b
]
->
IO
b
getRandomElement
list
=
do
getRandomElement
xs
=
do
index
<-
(
getRandomIndex
list
)
index
<-
(
getRandomIndex
xs
)
pure
(
list
List
.!!
index
)
pure
(
xs
List
.!!
index
)
src/Gargantext/Prelude/Mail.hs
View file @
986a7aa9
...
@@ -14,7 +14,7 @@ module Gargantext.Prelude.Mail
...
@@ -14,7 +14,7 @@ module Gargantext.Prelude.Mail
where
where
-- import Data.Text.Internal.Lazy (Text)
-- import Data.Text.Internal.Lazy (Text)
import
Data.Text
(
Text
,
unpack
)
import
Data.Text
(
unpack
)
import
Data.Maybe
import
Data.Maybe
import
Network.Mail.SMTP
hiding
(
htmlPart
,
STARTTLS
)
import
Network.Mail.SMTP
hiding
(
htmlPart
,
STARTTLS
)
import
Gargantext.Prelude
import
Gargantext.Prelude
...
@@ -22,7 +22,6 @@ import Gargantext.Prelude.Config (readIniFile', val)
...
@@ -22,7 +22,6 @@ import Gargantext.Prelude.Config (readIniFile', val)
import
Gargantext.Prelude.Mail.Types
(
LoginType
(
..
),
MailConfig
(
..
))
import
Gargantext.Prelude.Mail.Types
(
LoginType
(
..
),
MailConfig
(
..
))
import
Network.Mail.Mime
(
plainPart
)
import
Network.Mail.Mime
(
plainPart
)
import
Prelude
(
read
)
import
Prelude
(
read
)
import
System.IO
(
FilePath
)
type
Email
=
Text
type
Email
=
Text
...
@@ -61,9 +60,9 @@ gargMail (MailConfig {..}) (GargMail { .. }) = do
...
@@ -61,9 +60,9 @@ gargMail (MailConfig {..}) (GargMail { .. }) = do
TLS
->
sendMailWithLoginTLS'
host
_mc_mail_port
user
password
mail
TLS
->
sendMailWithLoginTLS'
host
_mc_mail_port
user
password
mail
STARTTLS
->
sendMailWithLoginSTARTTLS'
host
_mc_mail_port
user
password
mail
STARTTLS
->
sendMailWithLoginSTARTTLS'
host
_mc_mail_port
user
password
mail
where
where
mail
=
simpleMail
from
to
cc
bcc
gm_subject
[
plainPart
$
cs
gm_body
]
mail
=
simpleMail
sender
receiver
cc
bcc
gm_subject
[
plainPart
$
cs
gm_body
]
from
=
Address
(
Just
"GarganText Email"
)
_mc_mail_from
sender
=
Address
(
Just
"GarganText Email"
)
_mc_mail_from
to
=
[
Address
gm_name
gm_to
]
receiver
=
[
Address
gm_name
gm_to
]
cc
=
[]
cc
=
[]
bcc
=
[]
bcc
=
[]
src/Gargantext/Prelude/NLP.hs
View file @
986a7aa9
...
@@ -15,7 +15,6 @@ module Gargantext.Prelude.NLP
...
@@ -15,7 +15,6 @@ module Gargantext.Prelude.NLP
import
qualified
Data.Ini
as
Ini
import
qualified
Data.Ini
as
Ini
import
qualified
Data.Map.Strict
as
Map
import
qualified
Data.Map.Strict
as
Map
import
Data.Text
(
Text
,
unpack
)
import
qualified
Data.Text
as
T
import
qualified
Data.Text
as
T
import
Data.Maybe
import
Data.Maybe
import
Gargantext.Prelude
import
Gargantext.Prelude
...
@@ -23,12 +22,8 @@ import Gargantext.Prelude.Config (readIniFile', val)
...
@@ -23,12 +22,8 @@ import Gargantext.Prelude.Config (readIniFile', val)
import
Gargantext.Prelude.NLP.Types
(
NLPConfig
(
..
))
import
Gargantext.Prelude.NLP.Types
(
NLPConfig
(
..
))
import
Gargantext.Prelude.Utils
(
listToMaybeAll
)
import
Gargantext.Prelude.Utils
(
listToMaybeAll
)
import
Network.URI
(
parseURI
)
import
Network.URI
(
parseURI
)
import
Protolude
hiding
(
show
)
import
System.IO
(
FilePath
)
type
URL
=
Text
iniSection
::
Text
iniSection
::
Text
iniSection
=
"nlp"
iniSection
=
"nlp"
...
@@ -45,8 +40,8 @@ readConfig fp = do
...
@@ -45,8 +40,8 @@ readConfig fp = do
let
mRet
=
NLPConfig
<$>
m_nlp_all
<*>
(
Map
.
fromList
<$>
m_nlp_other
)
let
mRet
=
NLPConfig
<$>
m_nlp_all
<*>
(
Map
.
fromList
<$>
m_nlp_other
)
case
mRet
of
case
mRet
of
Nothing
->
panic
$
T
.
concat
[
"Cannot read config file: _nlp_all = "
Nothing
->
panic
Trace
$
T
.
concat
[
"Cannot read config file: _nlp_all = "
,
T
.
pack
$
show
m_nlp_all
,
T
.
pack
$
show
m_nlp_all
,
", _nlp_other = "
,
", _nlp_other = "
,
T
.
pack
$
show
m_nlp_other
]
,
T
.
pack
$
show
m_nlp_other
]
Just
ret
->
pure
ret
Just
ret
->
pure
ret
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