Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gargantext-ihaskell
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
gargantext-ihaskell
Commits
ca97362d
Commit
ca97362d
authored
Aug 08, 2015
by
Sumit Sahrawat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working version with multiple arguments
Still needs a lot of automation.
parent
19b13ce0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
9 deletions
+28
-9
Interactive.hs
...skell-widgets/src/IHaskell/Display/Widgets/Interactive.hs
+28
-9
No files found.
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Interactive.hs
View file @
ca97362d
...
...
@@ -9,7 +9,7 @@
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE ScopedTypeVariables #-}
module
IHaskell.Display.Widgets.Interactive
(
interactive
,
usingHList
)
where
module
IHaskell.Display.Widgets.Interactive
(
interactive
,
usingHList
,
liftToWidgets
)
where
import
Data.Text
import
Data.Proxy
...
...
@@ -29,6 +29,7 @@ import IHaskell.Display.Widgets.Common
import
qualified
IHaskell.Display.Widgets.Singletons
as
S
(
SField
(
..
),
Field
(
..
))
import
IHaskell.Display.Widgets.Box.FlexBox
import
IHaskell.Display.Widgets.Bool.CheckBox
import
IHaskell.Display.Widgets.String.Text
import
IHaskell.Display.Widgets.Int.BoundedInt.IntSlider
import
IHaskell.Display.Widgets.Output
...
...
@@ -97,18 +98,24 @@ mkChildren :: Rec RequiredWidget a -> [ChildWidget]
mkChildren
widgets
=
let
childRecord
=
rmap
(
\
(
RequiredWidget
w
)
->
Const
(
ChildWidget
w
))
widgets
in
recordToList
childRecord
{-
-- TODO: Finish Thi
s
class
MakeConfs
(
ts
::
[
*
])
where
mkConfs
::
proxy
ts
->
Rec
WidgetConf
t
s
mkConfs SNil = RNil
mkConfs (SCons selem srest) = WidgetConf wrapped :& mkConfs srest
instance
MakeConfs
'[
]
where
mkConfs
_
=
RNil
interactive :: (RecAll Identity ts FromWidget, IHaskellDisplay r)
instance
(
FromWidget
t
,
MakeConfs
ts
)
=>
MakeConfs
(
t
':
ts
)
where
mkConfs
_
=
WidgetConf
wrapped
:&
mkConfs
(
Proxy
::
Proxy
ts
)
-- interactive :: (RecAll Identity ts FromWidget, IHaskellDisplay r, MakeConfs ts)
-- => WithTypes ts r -> IO FlexBox
-- interactive = undefined
-- | A version of interactive that workss with a function on HList instead of values
interactive
::
(
RecAll
Identity
ts
FromWidget
,
IHaskellDisplay
r
,
MakeConfs
ts
)
=>
(
HList
ts
->
r
)
->
IO
FlexBox
interactive func = let confs = mkConfs
undefined
interactive
func
=
let
confs
=
mkConfs
Proxy
in
liftToWidgets
func
confs
-}
interactive
=
undefined
-- | Lift a function (HList ts -> r) to one using widgets to fill the HList and displaying the
-- output through the resultant widget.
...
...
@@ -165,6 +172,12 @@ class RecAll Attr (WidgetFields (SuitableWidget a)) ToPairs => FromWidget a wher
type
SuitableField
a
::
S
.
Field
wrapped
::
WrappedWidget
(
SuitableWidget
a
)
(
SuitableHandler
a
)
(
SuitableField
a
)
a
instance
FromWidget
Bool
where
type
SuitableWidget
Bool
=
CheckBoxType
type
SuitableHandler
Bool
=
S
.
ChangeHandler
type
SuitableField
Bool
=
S
.
BoolValue
wrapped
=
WrappedWidget
mkCheckBox
ChangeHandler
BoolValue
instance
FromWidget
Text
where
type
SuitableWidget
Text
=
TextType
type
SuitableHandler
Text
=
S
.
SubmitHandler
...
...
@@ -177,6 +190,12 @@ instance FromWidget Integer where
type
SuitableField
Integer
=
S
.
IntValue
wrapped
=
WrappedWidget
mkIntSlider
ChangeHandler
IntValue
instance
FromWidget
a
=>
FromWidget
(
Identity
a
)
where
type
SuitableWidget
(
Identity
a
)
=
SuitableWidget
a
type
SuitableHandler
(
Identity
a
)
=
SuitableHandler
a
type
SuitableField
(
Identity
a
)
=
SuitableField
a
wrapped
=
wrapped
-- interactive :: (FromWidget a, IHaskellDisplay b) => (a -> b) -> IO FlexBox
-- interactive func = do
-- let wrap = wrapped
...
...
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