Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hikaru
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
hikaru
Commits
06b1638d
Verified
Commit
06b1638d
authored
5 years ago
by
jan.hamal.dvorak
Browse files
Options
Downloads
Patches
Plain Diff
Make Form exports more ergonomic
Signed-off-by:
Jan Hamal Dvořák
<
mordae@anilinux.org
>
parent
ea445ffd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/Hikaru/Form.hs
+22
-15
22 additions, 15 deletions
lib/Hikaru/Form.hs
with
22 additions
and
15 deletions
lib/Hikaru/Form.hs
+
22
−
15
View file @
06b1638d
...
...
@@ -31,10 +31,11 @@ module Hikaru.Form
,
multiSelectField'
,
opt
,
req
,
whenChecking
,
fieldShouldCheck
,
fieldValue
,
addNote
,
addAttribute
,
fieldCheck
,
fieldValue
,
hasErrors
)
where
...
...
@@ -433,17 +434,11 @@ where
--
req
::
(
Monad
m
)
=>
l
->
FieldT
l
a
m
()
req
label
=
do
shouldCheck
<-
fieldCheck
if
shouldCheck
then
do
value
<-
fieldValue
case
value
of
Nothing
->
addNote
$
NoteError
label
Just
_v
->
return
()
else
do
return
()
whenChecking
do
value
<-
fieldValue
case
value
of
Nothing
->
addNote
$
NoteError
label
Just
_v
->
return
()
-- |
...
...
@@ -466,8 +461,20 @@ where
-- |
-- TODO
--
fieldCheck
::
(
Monad
m
)
=>
FieldT
l
a
m
Bool
fieldCheck
=
FieldT
(
fst
<$>
ask
)
whenChecking
::
(
Monad
m
)
=>
FieldT
l
a
m
b
->
FieldT
l
a
m
()
whenChecking
checkField
=
do
check
<-
fieldShouldCheck
if
check
then
checkField
>>
return
()
else
return
()
-- |
-- TODO
--
fieldShouldCheck
::
(
Monad
m
)
=>
FieldT
l
a
m
Bool
fieldShouldCheck
=
FieldT
(
fst
<$>
ask
)
-- |
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment