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
6622b260
Commit
6622b260
authored
Jul 23, 2015
by
Sumit Sahrawat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of S prefix on singletons
parent
3a2228d2
Changes
30
Show whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
525 additions
and
442 deletions
+525
-442
.gitignore
ihaskell-display/ihaskell-widgets/.gitignore
+1
-0
ihaskell-widgets.cabal
ihaskell-display/ihaskell-widgets/ihaskell-widgets.cabal
+1
-0
CheckBox.hs
...ell-widgets/src/IHaskell/Display/Widgets/Bool/CheckBox.hs
+1
-1
ToggleButton.hs
...widgets/src/IHaskell/Display/Widgets/Bool/ToggleButton.hs
+4
-4
FlexBox.hs
...skell-widgets/src/IHaskell/Display/Widgets/Box/FlexBox.hs
+4
-4
Accordion.hs
...skell/Display/Widgets/Box/SelectionContainer/Accordion.hs
+1
-1
Tab.hs
...rc/IHaskell/Display/Widgets/Box/SelectionContainer/Tab.hs
+1
-1
Button.hs
...y/ihaskell-widgets/src/IHaskell/Display/Widgets/Button.hs
+6
-6
Common.hs
...y/ihaskell-widgets/src/IHaskell/Display/Widgets/Common.hs
+77
-84
BoundedFloatText.hs
...ll/Display/Widgets/Float/BoundedFloat/BoundedFloatText.hs
+1
-1
FloatProgress.hs
...skell/Display/Widgets/Float/BoundedFloat/FloatProgress.hs
+1
-1
FloatSlider.hs
...Haskell/Display/Widgets/Float/BoundedFloat/FloatSlider.hs
+5
-5
FloatRangeSlider.hs
...splay/Widgets/Float/BoundedFloatRange/FloatRangeSlider.hs
+5
-5
FloatText.hs
...l-widgets/src/IHaskell/Display/Widgets/Float/FloatText.hs
+1
-1
Image.hs
...ay/ihaskell-widgets/src/IHaskell/Display/Widgets/Image.hs
+2
-2
BoundedIntText.hs
...IHaskell/Display/Widgets/Int/BoundedInt/BoundedIntText.hs
+1
-1
IntProgress.hs
...rc/IHaskell/Display/Widgets/Int/BoundedInt/IntProgress.hs
+1
-1
IntSlider.hs
.../src/IHaskell/Display/Widgets/Int/BoundedInt/IntSlider.hs
+5
-5
IntRangeSlider.hs
...ell/Display/Widgets/Int/BoundedIntRange/IntRangeSlider.hs
+5
-5
IntText.hs
...skell-widgets/src/IHaskell/Display/Widgets/Int/IntText.hs
+1
-1
Dropdown.hs
...idgets/src/IHaskell/Display/Widgets/Selection/Dropdown.hs
+6
-6
RadioButtons.hs
...ts/src/IHaskell/Display/Widgets/Selection/RadioButtons.hs
+5
-5
Select.hs
...-widgets/src/IHaskell/Display/Widgets/Selection/Select.hs
+5
-5
SelectMultiple.hs
.../src/IHaskell/Display/Widgets/Selection/SelectMultiple.hs
+5
-5
ToggleButtons.hs
...s/src/IHaskell/Display/Widgets/Selection/ToggleButtons.hs
+8
-8
Singletons.hs
...askell-widgets/src/IHaskell/Display/Widgets/Singletons.hs
+86
-0
Text.hs
...skell-widgets/src/IHaskell/Display/Widgets/String/Text.hs
+2
-2
TextArea.hs
...l-widgets/src/IHaskell/Display/Widgets/String/TextArea.hs
+2
-2
Types.hs
...ay/ihaskell-widgets/src/IHaskell/Display/Widgets/Types.hs
+281
-279
verify_formatting.py
verify_formatting.py
+1
-1
No files found.
ihaskell-display/ihaskell-widgets/.gitignore
0 → 100644
View file @
6622b260
Examples/.chart
ihaskell-display/ihaskell-widgets/ihaskell-widgets.cabal
View file @
6622b260
...
@@ -85,6 +85,7 @@ library
...
@@ -85,6 +85,7 @@ library
IHaskell.Display.Widgets.Types
IHaskell.Display.Widgets.Types
IHaskell.Display.Widgets.Common
IHaskell.Display.Widgets.Common
IHaskell.Display.Widgets.Singletons
-- LANGUAGE extensions used by modules in this package.
-- LANGUAGE extensions used by modules in this package.
-- other-extensions:
-- other-extensions:
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Bool/CheckBox.hs
View file @
6622b260
...
@@ -61,5 +61,5 @@ instance IHaskellWidget CheckBox where
...
@@ -61,5 +61,5 @@ instance IHaskellWidget CheckBox where
key2
=
"value"
::
Text
key2
=
"value"
::
Text
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Bool
value
)
=
HM
.
lookup
key2
dict2
Just
(
Bool
value
)
=
HM
.
lookup
key2
dict2
setField'
widget
S
BoolValue
value
setField'
widget
BoolValue
value
triggerChange
widget
triggerChange
widget
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Bool/ToggleButton.hs
View file @
6622b260
...
@@ -36,9 +36,9 @@ mkToggleButton = do
...
@@ -36,9 +36,9 @@ mkToggleButton = do
uuid
<-
U
.
random
uuid
<-
U
.
random
let
boolState
=
defaultBoolWidget
"ToggleButtonView"
let
boolState
=
defaultBoolWidget
"ToggleButtonView"
toggleState
=
(
S
Tooltip
=::
""
)
toggleState
=
(
Tooltip
=::
""
)
:&
(
S
Icon
=::
""
)
:&
(
Icon
=::
""
)
:&
(
S
ButtonStyle
=::
DefaultButton
)
:&
(
ButtonStyle
=::
DefaultButton
)
:&
RNil
:&
RNil
widgetState
=
WidgetState
(
boolState
<+>
toggleState
)
widgetState
=
WidgetState
(
boolState
<+>
toggleState
)
...
@@ -66,5 +66,5 @@ instance IHaskellWidget ToggleButton where
...
@@ -66,5 +66,5 @@ instance IHaskellWidget ToggleButton where
key2
=
"value"
::
Text
key2
=
"value"
::
Text
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Bool
value
)
=
HM
.
lookup
key2
dict2
Just
(
Bool
value
)
=
HM
.
lookup
key2
dict2
setField'
widget
S
BoolValue
value
setField'
widget
BoolValue
value
triggerChange
widget
triggerChange
widget
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Box/FlexBox.hs
View file @
6622b260
...
@@ -36,10 +36,10 @@ mkFlexBox = do
...
@@ -36,10 +36,10 @@ mkFlexBox = do
uuid
<-
U
.
random
uuid
<-
U
.
random
let
boxAttrs
=
defaultBoxWidget
"FlexBoxView"
let
boxAttrs
=
defaultBoxWidget
"FlexBoxView"
flxAttrs
=
(
S
Orientation
=::
HorizontalOrientation
)
flxAttrs
=
(
Orientation
=::
HorizontalOrientation
)
:&
(
S
Flex
=::
0
)
:&
(
Flex
=::
0
)
:&
(
S
Pack
=::
StartLocation
)
:&
(
Pack
=::
StartLocation
)
:&
(
S
Align
=::
StartLocation
)
:&
(
Align
=::
StartLocation
)
:&
RNil
:&
RNil
widgetState
=
WidgetState
$
boxAttrs
<+>
flxAttrs
widgetState
=
WidgetState
$
boxAttrs
<+>
flxAttrs
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Box/SelectionContainer/Accordion.hs
View file @
6622b260
...
@@ -62,5 +62,5 @@ instance IHaskellWidget Accordion where
...
@@ -62,5 +62,5 @@ instance IHaskellWidget Accordion where
key2
=
"selected_index"
::
Text
key2
=
"selected_index"
::
Text
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Number
num
)
=
HM
.
lookup
key2
dict2
Just
(
Number
num
)
=
HM
.
lookup
key2
dict2
setField'
widget
S
S
electedIndex
(
Sci
.
coefficient
num
)
setField'
widget
SelectedIndex
(
Sci
.
coefficient
num
)
triggerChange
widget
triggerChange
widget
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Box/SelectionContainer/Tab.hs
View file @
6622b260
...
@@ -61,5 +61,5 @@ instance IHaskellWidget TabWidget where
...
@@ -61,5 +61,5 @@ instance IHaskellWidget TabWidget where
key2
=
"selected_index"
::
Text
key2
=
"selected_index"
::
Text
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Number
num
)
=
HM
.
lookup
key2
dict2
Just
(
Number
num
)
=
HM
.
lookup
key2
dict2
setField'
widget
S
S
electedIndex
(
Sci
.
coefficient
num
)
setField'
widget
SelectedIndex
(
Sci
.
coefficient
num
)
triggerChange
widget
triggerChange
widget
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Button.hs
View file @
6622b260
...
@@ -36,12 +36,12 @@ mkButton = do
...
@@ -36,12 +36,12 @@ mkButton = do
uuid
<-
U
.
random
uuid
<-
U
.
random
let
dom
=
defaultDOMWidget
"ButtonView"
let
dom
=
defaultDOMWidget
"ButtonView"
but
=
(
S
Description
=::
""
)
but
=
(
Description
=::
""
)
:&
(
S
Tooltip
=::
""
)
:&
(
Tooltip
=::
""
)
:&
(
S
Disabled
=::
False
)
:&
(
Disabled
=::
False
)
:&
(
S
Icon
=::
""
)
:&
(
Icon
=::
""
)
:&
(
S
ButtonStyle
=::
DefaultButton
)
:&
(
ButtonStyle
=::
DefaultButton
)
:&
(
S
ClickHandler
=::
return
()
)
:&
(
ClickHandler
=::
return
()
)
:&
RNil
:&
RNil
buttonState
=
WidgetState
(
dom
<+>
but
)
buttonState
=
WidgetState
(
dom
<+>
but
)
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Common.hs
View file @
6622b260
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module
IHaskell.Display.Widgets.Common
where
module
IHaskell.Display.Widgets.Common
where
import
Data.Aeson
import
Data.Aeson
import
Data.Aeson.Types
(
emptyObject
)
import
Data.Aeson.Types
(
emptyObject
)
import
Data.Text
(
pack
,
Text
)
import
Data.Text
(
pack
,
Text
)
import
Data.Singletons.TH
import
IHaskell.Display
(
IHaskellWidget
)
import
IHaskell.Display
(
IHaskellWidget
)
import
IHaskell.Eval.Widgets
(
widgetSendClose
)
import
IHaskell.Eval.Widgets
(
widgetSendClose
)
import
qualified
IHaskell.Display.Widgets.Singletons
as
S
pattern
ViewModule
=
S
.
SViewModule
pattern
ViewName
=
S
.
SViewName
pattern
MsgThrottle
=
S
.
SMsgThrottle
pattern
Version
=
S
.
SVersion
pattern
DisplayHandler
=
S
.
SDisplayHandler
pattern
Visible
=
S
.
SVisible
pattern
CSS
=
S
.
SCSS
pattern
DOMClasses
=
S
.
SDOMClasses
pattern
Width
=
S
.
SWidth
pattern
Height
=
S
.
SHeight
pattern
Padding
=
S
.
SPadding
pattern
Margin
=
S
.
SMargin
pattern
Color
=
S
.
SColor
pattern
BackgroundColor
=
S
.
SBackgroundColor
pattern
BorderColor
=
S
.
SBorderColor
pattern
BorderWidth
=
S
.
SBorderWidth
pattern
BorderRadius
=
S
.
SBorderRadius
pattern
BorderStyle
=
S
.
SBorderStyle
pattern
FontStyle
=
S
.
SFontStyle
pattern
FontWeight
=
S
.
SFontWeight
pattern
FontSize
=
S
.
SFontSize
pattern
FontFamily
=
S
.
SFontFamily
pattern
Description
=
S
.
SDescription
pattern
ClickHandler
=
S
.
SClickHandler
pattern
SubmitHandler
=
S
.
SSubmitHandler
pattern
Disabled
=
S
.
SDisabled
pattern
StringValue
=
S
.
SStringValue
pattern
Placeholder
=
S
.
SPlaceholder
pattern
Tooltip
=
S
.
STooltip
pattern
Icon
=
S
.
SIcon
pattern
ButtonStyle
=
S
.
SButtonStyle
pattern
B64Value
=
S
.
SB64Value
pattern
ImageFormat
=
S
.
SImageFormat
pattern
BoolValue
=
S
.
SBoolValue
pattern
Options
=
S
.
SOptions
pattern
SelectedLabel
=
S
.
SSelectedLabel
pattern
SelectedValue
=
S
.
SSelectedValue
pattern
SelectionHandler
=
S
.
SSelectionHandler
pattern
Tooltips
=
S
.
STooltips
pattern
Icons
=
S
.
SIcons
pattern
SelectedLabels
=
S
.
SSelectedLabels
pattern
SelectedValues
=
S
.
SSelectedValues
pattern
IntValue
=
S
.
SIntValue
pattern
StepInt
=
S
.
SStepInt
pattern
MaxInt
=
S
.
SMaxInt
pattern
MinInt
=
S
.
SMinInt
pattern
IntPairValue
=
S
.
SIntPairValue
pattern
LowerInt
=
S
.
SLowerInt
pattern
UpperInt
=
S
.
SUpperInt
pattern
FloatValue
=
S
.
SFloatValue
pattern
StepFloat
=
S
.
SStepFloat
pattern
MaxFloat
=
S
.
SMaxFloat
pattern
MinFloat
=
S
.
SMinFloat
pattern
FloatPairValue
=
S
.
SFloatPairValue
pattern
LowerFloat
=
S
.
SLowerFloat
pattern
UpperFloat
=
S
.
SUpperFloat
pattern
Orientation
=
S
.
SOrientation
pattern
ShowRange
=
S
.
SShowRange
pattern
ReadOut
=
S
.
SReadOut
pattern
SliderColor
=
S
.
SSliderColor
pattern
BarStyle
=
S
.
SBarStyle
pattern
ChangeHandler
=
S
.
SChangeHandler
pattern
Children
=
S
.
SChildren
pattern
OverflowX
=
S
.
SOverflowX
pattern
OverflowY
=
S
.
SOverflowY
pattern
BoxStyle
=
S
.
SBoxStyle
pattern
Flex
=
S
.
SFlex
pattern
Pack
=
S
.
SPack
pattern
Align
=
S
.
SAlign
pattern
Titles
=
S
.
STitles
pattern
SelectedIndex
=
S
.
SSelectedIndex
-- | Close a widget's comm
-- | Close a widget's comm
closeWidget
::
IHaskellWidget
w
=>
w
->
IO
()
closeWidget
::
IHaskellWidget
w
=>
w
->
IO
()
closeWidget
w
=
widgetSendClose
w
emptyObject
closeWidget
w
=
widgetSendClose
w
emptyObject
-- Widget properties
singletons
[
d
|
data Field = ViewModule
| ViewName
| MsgThrottle
| Version
| DisplayHandler
| Visible
| CSS
| DOMClasses
| Width
| Height
| Padding
| Margin
| Color
| BackgroundColor
| BorderColor
| BorderWidth
| BorderRadius
| BorderStyle
| FontStyle
| FontWeight
| FontSize
| FontFamily
| Description
| ClickHandler
| SubmitHandler
| Disabled
| StringValue
| Placeholder
| Tooltip
| Icon
| ButtonStyle
| B64Value
| ImageFormat
| BoolValue
| Options
| SelectedLabel
| SelectedValue
| SelectionHandler
| Tooltips
| Icons
| SelectedLabels
| SelectedValues
| IntValue
| StepInt
| MaxInt
| MinInt
| IntPairValue
| LowerInt
| UpperInt
| FloatValue
| StepFloat
| MaxFloat
| MinFloat
| FloatPairValue
| LowerFloat
| UpperFloat
| Orientation
| ShowRange
| ReadOut
| SliderColor
| BarStyle
| ChangeHandler
| Children
| OverflowX
| OverflowY
| BoxStyle
| Flex
| Pack
| Align
| Titles
| SelectedIndex
deriving (Eq, Ord, Show)
|]
newtype
StrInt
=
StrInt
Integer
deriving
(
Num
,
Ord
,
Eq
,
Enum
)
newtype
StrInt
=
StrInt
Integer
deriving
(
Num
,
Ord
,
Eq
,
Enum
)
instance
ToJSON
StrInt
where
instance
ToJSON
StrInt
where
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Float/BoundedFloat/BoundedFloatText.hs
View file @
6622b260
...
@@ -65,5 +65,5 @@ instance IHaskellWidget BoundedFloatText where
...
@@ -65,5 +65,5 @@ instance IHaskellWidget BoundedFloatText where
key2
=
"value"
::
Text
key2
=
"value"
::
Text
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Number
value
)
=
HM
.
lookup
key2
dict2
Just
(
Number
value
)
=
HM
.
lookup
key2
dict2
setField'
widget
S
FloatValue
(
Sci
.
toRealFloat
value
)
setField'
widget
FloatValue
(
Sci
.
toRealFloat
value
)
triggerChange
widget
triggerChange
widget
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Float/BoundedFloat/FloatProgress.hs
View file @
6622b260
...
@@ -38,7 +38,7 @@ mkFloatProgress = do
...
@@ -38,7 +38,7 @@ mkFloatProgress = do
uuid
<-
U
.
random
uuid
<-
U
.
random
let
boundedFloatAttrs
=
defaultBoundedFloatWidget
"ProgressView"
let
boundedFloatAttrs
=
defaultBoundedFloatWidget
"ProgressView"
progressAttrs
=
(
S
BarStyle
=::
DefaultBar
)
:&
RNil
progressAttrs
=
(
BarStyle
=::
DefaultBar
)
:&
RNil
widgetState
=
WidgetState
$
boundedFloatAttrs
<+>
progressAttrs
widgetState
=
WidgetState
$
boundedFloatAttrs
<+>
progressAttrs
stateIO
<-
newIORef
widgetState
stateIO
<-
newIORef
widgetState
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Float/BoundedFloat/FloatSlider.hs
View file @
6622b260
...
@@ -37,10 +37,10 @@ mkFloatSlider = do
...
@@ -37,10 +37,10 @@ mkFloatSlider = do
uuid
<-
U
.
random
uuid
<-
U
.
random
let
boundedFloatAttrs
=
defaultBoundedFloatWidget
"FloatSliderView"
let
boundedFloatAttrs
=
defaultBoundedFloatWidget
"FloatSliderView"
sliderAttrs
=
(
S
Orientation
=::
HorizontalOrientation
)
sliderAttrs
=
(
Orientation
=::
HorizontalOrientation
)
:&
(
S
S
howRange
=::
False
)
:&
(
ShowRange
=::
False
)
:&
(
S
ReadOut
=::
True
)
:&
(
ReadOut
=::
True
)
:&
(
S
S
liderColor
=::
""
)
:&
(
SliderColor
=::
""
)
:&
RNil
:&
RNil
widgetState
=
WidgetState
$
boundedFloatAttrs
<+>
sliderAttrs
widgetState
=
WidgetState
$
boundedFloatAttrs
<+>
sliderAttrs
...
@@ -68,5 +68,5 @@ instance IHaskellWidget FloatSlider where
...
@@ -68,5 +68,5 @@ instance IHaskellWidget FloatSlider where
key2
=
"value"
::
Text
key2
=
"value"
::
Text
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Number
value
)
=
HM
.
lookup
key2
dict2
Just
(
Number
value
)
=
HM
.
lookup
key2
dict2
setField'
widget
S
FloatValue
(
Sci
.
toRealFloat
value
)
setField'
widget
FloatValue
(
Sci
.
toRealFloat
value
)
triggerChange
widget
triggerChange
widget
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Float/BoundedFloatRange/FloatRangeSlider.hs
View file @
6622b260
...
@@ -40,10 +40,10 @@ mkFloatRangeSlider = do
...
@@ -40,10 +40,10 @@ mkFloatRangeSlider = do
uuid
<-
U
.
random
uuid
<-
U
.
random
let
boundedFloatAttrs
=
defaultBoundedFloatRangeWidget
"FloatSliderView"
let
boundedFloatAttrs
=
defaultBoundedFloatRangeWidget
"FloatSliderView"
sliderAttrs
=
(
S
Orientation
=::
HorizontalOrientation
)
sliderAttrs
=
(
Orientation
=::
HorizontalOrientation
)
:&
(
S
S
howRange
=::
True
)
:&
(
ShowRange
=::
True
)
:&
(
S
ReadOut
=::
True
)
:&
(
ReadOut
=::
True
)
:&
(
S
S
liderColor
=::
""
)
:&
(
SliderColor
=::
""
)
:&
RNil
:&
RNil
widgetState
=
WidgetState
$
boundedFloatAttrs
<+>
sliderAttrs
widgetState
=
WidgetState
$
boundedFloatAttrs
<+>
sliderAttrs
...
@@ -74,5 +74,5 @@ instance IHaskellWidget FloatRangeSlider where
...
@@ -74,5 +74,5 @@ instance IHaskellWidget FloatRangeSlider where
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Array
values
)
=
HM
.
lookup
key2
dict2
Just
(
Array
values
)
=
HM
.
lookup
key2
dict2
[
x
,
y
]
=
map
(
\
(
Number
x
)
->
Sci
.
toRealFloat
x
)
$
V
.
toList
values
[
x
,
y
]
=
map
(
\
(
Number
x
)
->
Sci
.
toRealFloat
x
)
$
V
.
toList
values
setField'
widget
S
FloatPairValue
(
x
,
y
)
setField'
widget
FloatPairValue
(
x
,
y
)
triggerChange
widget
triggerChange
widget
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Float/FloatText.hs
View file @
6622b260
...
@@ -62,5 +62,5 @@ instance IHaskellWidget FloatText where
...
@@ -62,5 +62,5 @@ instance IHaskellWidget FloatText where
key2
=
"value"
::
Text
key2
=
"value"
::
Text
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Number
value
)
=
HM
.
lookup
key2
dict2
Just
(
Number
value
)
=
HM
.
lookup
key2
dict2
setField'
widget
S
FloatValue
(
Sci
.
toRealFloat
value
)
setField'
widget
FloatValue
(
Sci
.
toRealFloat
value
)
triggerChange
widget
triggerChange
widget
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Image.hs
View file @
6622b260
...
@@ -37,8 +37,8 @@ mkImageWidget = do
...
@@ -37,8 +37,8 @@ mkImageWidget = do
uuid
<-
U
.
random
uuid
<-
U
.
random
let
dom
=
defaultDOMWidget
"ImageView"
let
dom
=
defaultDOMWidget
"ImageView"
img
=
(
S
ImageFormat
=::
PNG
)
img
=
(
ImageFormat
=::
PNG
)
:&
(
S
B64Value
=::
mempty
)
:&
(
B64Value
=::
mempty
)
:&
RNil
:&
RNil
widgetState
=
WidgetState
(
dom
<+>
img
)
widgetState
=
WidgetState
(
dom
<+>
img
)
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Int/BoundedInt/BoundedIntText.hs
View file @
6622b260
...
@@ -64,5 +64,5 @@ instance IHaskellWidget BoundedIntText where
...
@@ -64,5 +64,5 @@ instance IHaskellWidget BoundedIntText where
key2
=
"value"
::
Text
key2
=
"value"
::
Text
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Number
value
)
=
HM
.
lookup
key2
dict2
Just
(
Number
value
)
=
HM
.
lookup
key2
dict2
setField'
widget
S
IntValue
(
Sci
.
coefficient
value
)
setField'
widget
IntValue
(
Sci
.
coefficient
value
)
triggerChange
widget
triggerChange
widget
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Int/BoundedInt/IntProgress.hs
View file @
6622b260
...
@@ -38,7 +38,7 @@ mkIntProgress = do
...
@@ -38,7 +38,7 @@ mkIntProgress = do
uuid
<-
U
.
random
uuid
<-
U
.
random
let
boundedIntAttrs
=
defaultBoundedIntWidget
"ProgressView"
let
boundedIntAttrs
=
defaultBoundedIntWidget
"ProgressView"
progressAttrs
=
(
S
BarStyle
=::
DefaultBar
)
:&
RNil
progressAttrs
=
(
BarStyle
=::
DefaultBar
)
:&
RNil
widgetState
=
WidgetState
$
boundedIntAttrs
<+>
progressAttrs
widgetState
=
WidgetState
$
boundedIntAttrs
<+>
progressAttrs
stateIO
<-
newIORef
widgetState
stateIO
<-
newIORef
widgetState
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Int/BoundedInt/IntSlider.hs
View file @
6622b260
...
@@ -37,10 +37,10 @@ mkIntSlider = do
...
@@ -37,10 +37,10 @@ mkIntSlider = do
uuid
<-
U
.
random
uuid
<-
U
.
random
let
boundedIntAttrs
=
defaultBoundedIntWidget
"IntSliderView"
let
boundedIntAttrs
=
defaultBoundedIntWidget
"IntSliderView"
sliderAttrs
=
(
S
Orientation
=::
HorizontalOrientation
)
sliderAttrs
=
(
Orientation
=::
HorizontalOrientation
)
:&
(
S
S
howRange
=::
False
)
:&
(
ShowRange
=::
False
)
:&
(
S
ReadOut
=::
True
)
:&
(
ReadOut
=::
True
)
:&
(
S
S
liderColor
=::
""
)
:&
(
SliderColor
=::
""
)
:&
RNil
:&
RNil
widgetState
=
WidgetState
$
boundedIntAttrs
<+>
sliderAttrs
widgetState
=
WidgetState
$
boundedIntAttrs
<+>
sliderAttrs
...
@@ -68,5 +68,5 @@ instance IHaskellWidget IntSlider where
...
@@ -68,5 +68,5 @@ instance IHaskellWidget IntSlider where
key2
=
"value"
::
Text
key2
=
"value"
::
Text
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Number
value
)
=
HM
.
lookup
key2
dict2
Just
(
Number
value
)
=
HM
.
lookup
key2
dict2
setField'
widget
S
IntValue
(
Sci
.
coefficient
value
)
setField'
widget
IntValue
(
Sci
.
coefficient
value
)
triggerChange
widget
triggerChange
widget
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Int/BoundedIntRange/IntRangeSlider.hs
View file @
6622b260
...
@@ -38,10 +38,10 @@ mkIntRangeSlider = do
...
@@ -38,10 +38,10 @@ mkIntRangeSlider = do
uuid
<-
U
.
random
uuid
<-
U
.
random
let
boundedIntAttrs
=
defaultBoundedIntRangeWidget
"IntSliderView"
let
boundedIntAttrs
=
defaultBoundedIntRangeWidget
"IntSliderView"
sliderAttrs
=
(
S
Orientation
=::
HorizontalOrientation
)
sliderAttrs
=
(
Orientation
=::
HorizontalOrientation
)
:&
(
S
S
howRange
=::
True
)
:&
(
ShowRange
=::
True
)
:&
(
S
ReadOut
=::
True
)
:&
(
ReadOut
=::
True
)
:&
(
S
S
liderColor
=::
""
)
:&
(
SliderColor
=::
""
)
:&
RNil
:&
RNil
widgetState
=
WidgetState
$
boundedIntAttrs
<+>
sliderAttrs
widgetState
=
WidgetState
$
boundedIntAttrs
<+>
sliderAttrs
...
@@ -72,5 +72,5 @@ instance IHaskellWidget IntRangeSlider where
...
@@ -72,5 +72,5 @@ instance IHaskellWidget IntRangeSlider where
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Array
values
)
=
HM
.
lookup
key2
dict2
Just
(
Array
values
)
=
HM
.
lookup
key2
dict2
[
x
,
y
]
=
map
(
\
(
Number
x
)
->
Sci
.
coefficient
x
)
$
V
.
toList
values
[
x
,
y
]
=
map
(
\
(
Number
x
)
->
Sci
.
coefficient
x
)
$
V
.
toList
values
setField'
widget
S
IntPairValue
(
x
,
y
)
setField'
widget
IntPairValue
(
x
,
y
)
triggerChange
widget
triggerChange
widget
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Int/IntText.hs
View file @
6622b260
...
@@ -61,5 +61,5 @@ instance IHaskellWidget IntText where
...
@@ -61,5 +61,5 @@ instance IHaskellWidget IntText where
key2
=
"value"
::
Text
key2
=
"value"
::
Text
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Number
value
)
=
HM
.
lookup
key2
dict2
Just
(
Number
value
)
=
HM
.
lookup
key2
dict2
setField'
widget
S
IntValue
(
Sci
.
coefficient
value
)
setField'
widget
IntValue
(
Sci
.
coefficient
value
)
triggerChange
widget
triggerChange
widget
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Selection/Dropdown.hs
View file @
6622b260
...
@@ -35,7 +35,7 @@ mkDropdown = do
...
@@ -35,7 +35,7 @@ mkDropdown = do
-- Default properties, with a random uuid
-- Default properties, with a random uuid
uuid
<-
U
.
random
uuid
<-
U
.
random
let
selectionAttrs
=
defaultSelectionWidget
"DropdownView"
let
selectionAttrs
=
defaultSelectionWidget
"DropdownView"
dropdownAttrs
=
(
S
ButtonStyle
=::
DefaultButton
)
:&
RNil
dropdownAttrs
=
(
ButtonStyle
=::
DefaultButton
)
:&
RNil
widgetState
=
WidgetState
$
selectionAttrs
<+>
dropdownAttrs
widgetState
=
WidgetState
$
selectionAttrs
<+>
dropdownAttrs
stateIO
<-
newIORef
widgetState
stateIO
<-
newIORef
widgetState
...
@@ -62,15 +62,15 @@ instance IHaskellWidget Dropdown where
...
@@ -62,15 +62,15 @@ instance IHaskellWidget Dropdown where
key2
=
"selected_label"
::
Text
key2
=
"selected_label"
::
Text
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
String
label
)
=
HM
.
lookup
key2
dict2
Just
(
String
label
)
=
HM
.
lookup
key2
dict2
opts
<-
getField
widget
S
Options
opts
<-
getField
widget
Options
case
opts
of
case
opts
of
OptionLabels
_
->
void
$
do
OptionLabels
_
->
void
$
do
setField'
widget
S
S
electedLabel
label
setField'
widget
SelectedLabel
label
setField'
widget
S
S
electedValue
label
setField'
widget
SelectedValue
label
OptionDict
ps
->
OptionDict
ps
->
case
lookup
label
ps
of
case
lookup
label
ps
of
Nothing
->
return
()
Nothing
->
return
()
Just
value
->
void
$
do
Just
value
->
void
$
do
setField'
widget
S
S
electedLabel
label
setField'
widget
SelectedLabel
label
setField'
widget
S
S
electedValue
value
setField'
widget
SelectedValue
value
triggerSelection
widget
triggerSelection
widget
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Selection/RadioButtons.hs
View file @
6622b260
...
@@ -60,15 +60,15 @@ instance IHaskellWidget RadioButtons where
...
@@ -60,15 +60,15 @@ instance IHaskellWidget RadioButtons where
key2
=
"selected_label"
::
Text
key2
=
"selected_label"
::
Text
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
String
label
)
=
HM
.
lookup
key2
dict2
Just
(
String
label
)
=
HM
.
lookup
key2
dict2
opts
<-
getField
widget
S
Options
opts
<-
getField
widget
Options
case
opts
of
case
opts
of
OptionLabels
_
->
void
$
do
OptionLabels
_
->
void
$
do
setField'
widget
S
S
electedLabel
label
setField'
widget
SelectedLabel
label
setField'
widget
S
S
electedValue
label
setField'
widget
SelectedValue
label
OptionDict
ps
->
OptionDict
ps
->
case
lookup
label
ps
of
case
lookup
label
ps
of
Nothing
->
return
()
Nothing
->
return
()
Just
value
->
void
$
do
Just
value
->
void
$
do
setField'
widget
S
S
electedLabel
label
setField'
widget
SelectedLabel
label
setField'
widget
S
S
electedValue
value
setField'
widget
SelectedValue
value
triggerSelection
widget
triggerSelection
widget
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Selection/Select.hs
View file @
6622b260
...
@@ -59,15 +59,15 @@ instance IHaskellWidget Select where
...
@@ -59,15 +59,15 @@ instance IHaskellWidget Select where
key2
=
"selected_label"
::
Text
key2
=
"selected_label"
::
Text
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
String
label
)
=
HM
.
lookup
key2
dict2
Just
(
String
label
)
=
HM
.
lookup
key2
dict2
opts
<-
getField
widget
S
Options
opts
<-
getField
widget
Options
case
opts
of
case
opts
of
OptionLabels
_
->
void
$
do
OptionLabels
_
->
void
$
do
setField'
widget
S
S
electedLabel
label
setField'
widget
SelectedLabel
label
setField'
widget
S
S
electedValue
label
setField'
widget
SelectedValue
label
OptionDict
ps
->
OptionDict
ps
->
case
lookup
label
ps
of
case
lookup
label
ps
of
Nothing
->
return
()
Nothing
->
return
()
Just
value
->
void
$
do
Just
value
->
void
$
do
setField'
widget
S
S
electedLabel
label
setField'
widget
SelectedLabel
label
setField'
widget
S
S
electedValue
value
setField'
widget
SelectedValue
value
triggerSelection
widget
triggerSelection
widget
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Selection/SelectMultiple.hs
View file @
6622b260
...
@@ -64,15 +64,15 @@ instance IHaskellWidget SelectMultiple where
...
@@ -64,15 +64,15 @@ instance IHaskellWidget SelectMultiple where
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Array
labels
)
=
HM
.
lookup
key2
dict2
Just
(
Array
labels
)
=
HM
.
lookup
key2
dict2
labelList
=
map
(
\
(
String
x
)
->
x
)
$
V
.
toList
labels
labelList
=
map
(
\
(
String
x
)
->
x
)
$
V
.
toList
labels
opts
<-
getField
widget
S
Options
opts
<-
getField
widget
Options
case
opts
of
case
opts
of
OptionLabels
_
->
void
$
do
OptionLabels
_
->
void
$
do
setField'
widget
S
S
electedLabels
labelList
setField'
widget
SelectedLabels
labelList
setField'
widget
S
S
electedValues
labelList
setField'
widget
SelectedValues
labelList
OptionDict
ps
->
OptionDict
ps
->
case
sequence
$
map
(`
lookup
`
ps
)
labelList
of
case
sequence
$
map
(`
lookup
`
ps
)
labelList
of
Nothing
->
return
()
Nothing
->
return
()
Just
valueList
->
void
$
do
Just
valueList
->
void
$
do
setField'
widget
S
S
electedLabels
labelList
setField'
widget
SelectedLabels
labelList
setField'
widget
S
S
electedValues
valueList
setField'
widget
SelectedValues
valueList
triggerSelection
widget
triggerSelection
widget
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Selection/ToggleButtons.hs
View file @
6622b260
...
@@ -35,9 +35,9 @@ mkToggleButtons = do
...
@@ -35,9 +35,9 @@ mkToggleButtons = do
-- Default properties, with a random uuid
-- Default properties, with a random uuid
uuid
<-
U
.
random
uuid
<-
U
.
random
let
selectionAttrs
=
defaultSelectionWidget
"ToggleButtonsView"
let
selectionAttrs
=
defaultSelectionWidget
"ToggleButtonsView"
toggleButtonsAttrs
=
(
S
Tooltips
=::
[]
)
toggleButtonsAttrs
=
(
Tooltips
=::
[]
)
:&
(
S
Icons
=::
[]
)
:&
(
Icons
=::
[]
)
:&
(
S
ButtonStyle
=::
DefaultButton
)
:&
(
ButtonStyle
=::
DefaultButton
)
:&
RNil
:&
RNil
widgetState
=
WidgetState
$
selectionAttrs
<+>
toggleButtonsAttrs
widgetState
=
WidgetState
$
selectionAttrs
<+>
toggleButtonsAttrs
...
@@ -67,15 +67,15 @@ instance IHaskellWidget ToggleButtons where
...
@@ -67,15 +67,15 @@ instance IHaskellWidget ToggleButtons where
key2
=
"selected_label"
::
Text
key2
=
"selected_label"
::
Text
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
String
label
)
=
HM
.
lookup
key2
dict2
Just
(
String
label
)
=
HM
.
lookup
key2
dict2
opts
<-
getField
widget
S
Options
opts
<-
getField
widget
Options
case
opts
of
case
opts
of
OptionLabels
_
->
void
$
do
OptionLabels
_
->
void
$
do
setField'
widget
S
S
electedLabel
label
setField'
widget
SelectedLabel
label
setField'
widget
S
S
electedValue
label
setField'
widget
SelectedValue
label
OptionDict
ps
->
OptionDict
ps
->
case
lookup
label
ps
of
case
lookup
label
ps
of
Nothing
->
return
()
Nothing
->
return
()
Just
value
->
void
$
do
Just
value
->
void
$
do
setField'
widget
S
S
electedLabel
label
setField'
widget
SelectedLabel
label
setField'
widget
S
S
electedValue
value
setField'
widget
SelectedValue
value
triggerSelection
widget
triggerSelection
widget
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Singletons.hs
0 → 100644
View file @
6622b260
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE QuasiQuotes #-}
module
IHaskell.Display.Widgets.Singletons
where
import
Data.Singletons.TH
-- Widget properties
singletons
[
d
|
data Field = ViewModule
| ViewName
| MsgThrottle
| Version
| DisplayHandler
| Visible
| CSS
| DOMClasses
| Width
| Height
| Padding
| Margin
| Color
| BackgroundColor
| BorderColor
| BorderWidth
| BorderRadius
| BorderStyle
| FontStyle
| FontWeight
| FontSize
| FontFamily
| Description
| ClickHandler
| SubmitHandler
| Disabled
| StringValue
| Placeholder
| Tooltip
| Icon
| ButtonStyle
| B64Value
| ImageFormat
| BoolValue
| Options
| SelectedLabel
| SelectedValue
| SelectionHandler
| Tooltips
| Icons
| SelectedLabels
| SelectedValues
| IntValue
| StepInt
| MaxInt
| MinInt
| IntPairValue
| LowerInt
| UpperInt
| FloatValue
| StepFloat
| MaxFloat
| MinFloat
| FloatPairValue
| LowerFloat
| UpperFloat
| Orientation
| ShowRange
| ReadOut
| SliderColor
| BarStyle
| ChangeHandler
| Children
| OverflowX
| OverflowY
| BoxStyle
| Flex
| Pack
| Align
| Titles
| SelectedIndex
deriving (Eq, Ord, Show)
|]
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/String/Text.hs
View file @
6622b260
...
@@ -35,7 +35,7 @@ mkTextWidget = do
...
@@ -35,7 +35,7 @@ mkTextWidget = do
-- Default properties, with a random uuid
-- Default properties, with a random uuid
uuid
<-
U
.
random
uuid
<-
U
.
random
let
strWidget
=
defaultStringWidget
"TextView"
let
strWidget
=
defaultStringWidget
"TextView"
txtWidget
=
(
S
SubmitHandler
=::
return
()
)
:&
(
S
ChangeHandler
=::
return
()
)
:&
RNil
txtWidget
=
(
S
ubmitHandler
=::
return
()
)
:&
(
ChangeHandler
=::
return
()
)
:&
RNil
widgetState
=
WidgetState
$
strWidget
<+>
txtWidget
widgetState
=
WidgetState
$
strWidget
<+>
txtWidget
stateIO
<-
newIORef
widgetState
stateIO
<-
newIORef
widgetState
...
@@ -61,7 +61,7 @@ instance IHaskellWidget TextWidget where
...
@@ -61,7 +61,7 @@ instance IHaskellWidget TextWidget where
case
Map
.
lookup
"sync_data"
dict1
of
case
Map
.
lookup
"sync_data"
dict1
of
Just
(
Object
dict2
)
->
Just
(
Object
dict2
)
->
case
Map
.
lookup
"value"
dict2
of
case
Map
.
lookup
"value"
dict2
of
Just
(
String
val
)
->
setField'
tw
S
S
tringValue
val
>>
triggerChange
tw
Just
(
String
val
)
->
setField'
tw
StringValue
val
>>
triggerChange
tw
Nothing
->
return
()
Nothing
->
return
()
Nothing
->
Nothing
->
case
Map
.
lookup
"content"
dict1
of
case
Map
.
lookup
"content"
dict1
of
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/String/TextArea.hs
View file @
6622b260
...
@@ -35,7 +35,7 @@ mkTextArea = do
...
@@ -35,7 +35,7 @@ mkTextArea = do
-- Default properties, with a random uuid
-- Default properties, with a random uuid
uuid
<-
U
.
random
uuid
<-
U
.
random
let
strAttrs
=
defaultStringWidget
"TextareaView"
let
strAttrs
=
defaultStringWidget
"TextareaView"
wgtAttrs
=
(
S
ChangeHandler
=::
return
()
)
:&
RNil
wgtAttrs
=
(
ChangeHandler
=::
return
()
)
:&
RNil
widgetState
=
WidgetState
$
strAttrs
<+>
wgtAttrs
widgetState
=
WidgetState
$
strAttrs
<+>
wgtAttrs
stateIO
<-
newIORef
widgetState
stateIO
<-
newIORef
widgetState
...
@@ -62,5 +62,5 @@ instance IHaskellWidget TextArea where
...
@@ -62,5 +62,5 @@ instance IHaskellWidget TextArea where
key2
=
"value"
::
Text
key2
=
"value"
::
Text
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
Object
dict2
)
=
HM
.
lookup
key1
dict1
Just
(
String
value
)
=
HM
.
lookup
key2
dict2
Just
(
String
value
)
=
HM
.
lookup
key2
dict2
setField'
widget
S
S
tringValue
value
setField'
widget
StringValue
value
triggerChange
widget
triggerChange
widget
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Types.hs
View file @
6622b260
...
@@ -54,7 +54,7 @@ module IHaskell.Display.Widgets.Types where
...
@@ -54,7 +54,7 @@ module IHaskell.Display.Widgets.Types where
--
--
-- Widgets are not able to do console input, the reason for that can also be found in the messaging
-- Widgets are not able to do console input, the reason for that can also be found in the messaging
-- specification
-- specification
import
Control.Monad
(
unless
,
join
,
when
,
void
)
import
Control.Monad
(
unless
,
join
,
when
,
void
,
mapM_
)
import
Control.Applicative
((
<$>
))
import
Control.Applicative
((
<$>
))
import
qualified
Control.Exception
as
Ex
import
qualified
Control.Exception
as
Ex
...
@@ -79,105 +79,107 @@ import IHaskell.Eval.Widgets (widgetSendUpdate)
...
@@ -79,105 +79,107 @@ import IHaskell.Eval.Widgets (widgetSendUpdate)
import
IHaskell.Display
(
Base64
,
IHaskellWidget
(
..
))
import
IHaskell.Display
(
Base64
,
IHaskellWidget
(
..
))
import
IHaskell.IPython.Message.UUID
import
IHaskell.IPython.Message.UUID
import
IHaskell.Display.Widgets.Singletons
(
Field
,
SField
(
..
))
import
qualified
IHaskell.Display.Widgets.Singletons
as
S
import
IHaskell.Display.Widgets.Common
import
IHaskell.Display.Widgets.Common
-- Classes from IPython's widget hierarchy. Defined as such to reduce code duplication.
-- Classes from IPython's widget hierarchy. Defined as such to reduce code duplication.
type
WidgetClass
=
'[
V
iewModule
,
ViewName
,
MsgThrottle
,
Version
,
DisplayHandler
]
type
WidgetClass
=
'[
S
.
ViewModule
,
S
.
ViewName
,
S
.
MsgThrottle
,
S
.
Version
,
S
.
DisplayHandler
]
type
DOMWidgetClass
=
WidgetClass
:++
type
DOMWidgetClass
=
WidgetClass
:++
'[
Visible
,
CSS
,
DOMClasses
,
Width
,
Height
,
Padding
,
Margin
,
Color
'[
S
.
Visible
,
S
.
CSS
,
S
.
DOMClasses
,
S
.
Width
,
S
.
Height
,
S
.
Padding
,
S
.
Margin
,
S
.
Color
,
BackgroundColor
,
BorderColor
,
BorderWidth
,
BorderRadius
,
BorderStyle
,
FontStyle
,
S
.
BackgroundColor
,
S
.
BorderColor
,
S
.
BorderWidth
,
S
.
BorderRadius
,
S
.
BorderStyle
,
S
.
FontStyle
,
FontWeight
,
FontSize
,
FontFamily
,
S
.
FontWeight
,
S
.
FontSize
,
S
.
FontFamily
]
]
type
StringClass
=
DOMWidgetClass
:++
'[
S
tringValue
,
Disabled
,
Description
,
Placeholder
]
type
StringClass
=
DOMWidgetClass
:++
'[
S
.
StringValue
,
S
.
Disabled
,
S
.
Description
,
S
.
Placeholder
]
type
BoolClass
=
DOMWidgetClass
:++
'[
B
oolValue
,
Disabled
,
Description
,
ChangeHandler
]
type
BoolClass
=
DOMWidgetClass
:++
'[
S
.
BoolValue
,
S
.
Disabled
,
S
.
Description
,
S
.
ChangeHandler
]
type
SelectionClass
=
DOMWidgetClass
:++
type
SelectionClass
=
DOMWidgetClass
:++
'[
O
ptions
,
SelectedValue
,
SelectedLabel
,
Disabled
,
Description
,
SelectionHandler
]
'[
S
.
Options
,
S
.
SelectedValue
,
S
.
SelectedLabel
,
S
.
Disabled
,
S
.
Description
,
S
.
SelectionHandler
]
type
MultipleSelectionClass
=
DOMWidgetClass
:++
type
MultipleSelectionClass
=
DOMWidgetClass
:++
'[
O
ptions
,
SelectedLabels
,
SelectedValues
,
Disabled
,
Description
,
SelectionHandler
]
'[
S
.
Options
,
S
.
SelectedLabels
,
S
.
SelectedValues
,
S
.
Disabled
,
S
.
Description
,
S
.
SelectionHandler
]
type
IntClass
=
DOMWidgetClass
:++
'[
I
ntValue
,
Disabled
,
Description
,
ChangeHandler
]
type
IntClass
=
DOMWidgetClass
:++
'[
S
.
IntValue
,
S
.
Disabled
,
S
.
Description
,
S
.
ChangeHandler
]
type
BoundedIntClass
=
IntClass
:++
'[
S
tepInt
,
MinInt
,
MaxInt
]
type
BoundedIntClass
=
IntClass
:++
'[
S
.
StepInt
,
S
.
MinInt
,
S
.
MaxInt
]
type
IntRangeClass
=
IntClass
:++
'[
I
ntPairValue
,
LowerInt
,
UpperInt
]
type
IntRangeClass
=
IntClass
:++
'[
S
.
IntPairValue
,
S
.
LowerInt
,
S
.
UpperInt
]
type
BoundedIntRangeClass
=
IntRangeClass
:++
'[
S
tepInt
,
MinInt
,
MaxInt
]
type
BoundedIntRangeClass
=
IntRangeClass
:++
'[
S
.
StepInt
,
S
.
MinInt
,
S
.
MaxInt
]
type
FloatClass
=
DOMWidgetClass
:++
'[
F
loatValue
,
Disabled
,
Description
,
ChangeHandler
]
type
FloatClass
=
DOMWidgetClass
:++
'[
S
.
FloatValue
,
S
.
Disabled
,
S
.
Description
,
S
.
ChangeHandler
]
type
BoundedFloatClass
=
FloatClass
:++
'[
S
tepFloat
,
MinFloat
,
MaxFloat
]
type
BoundedFloatClass
=
FloatClass
:++
'[
S
.
StepFloat
,
S
.
MinFloat
,
S
.
MaxFloat
]
type
FloatRangeClass
=
FloatClass
:++
'[
F
loatPairValue
,
LowerFloat
,
UpperFloat
]
type
FloatRangeClass
=
FloatClass
:++
'[
S
.
FloatPairValue
,
S
.
LowerFloat
,
S
.
UpperFloat
]
type
BoundedFloatRangeClass
=
FloatRangeClass
:++
'[
S
tepFloat
,
MinFloat
,
MaxFloat
]
type
BoundedFloatRangeClass
=
FloatRangeClass
:++
'[
S
.
StepFloat
,
S
.
MinFloat
,
S
.
MaxFloat
]
type
BoxClass
=
DOMWidgetClass
:++
'[
C
hildren
,
OverflowX
,
OverflowY
,
BoxStyle
]
type
BoxClass
=
DOMWidgetClass
:++
'[
S
.
Children
,
S
.
OverflowX
,
S
.
OverflowY
,
S
.
BoxStyle
]
type
SelectionContainerClass
=
BoxClass
:++
'[
T
itles
,
SelectedIndex
,
ChangeHandler
]
type
SelectionContainerClass
=
BoxClass
:++
'[
S
.
Titles
,
S
.
SelectedIndex
,
S
.
ChangeHandler
]
-- Types associated with Fields.
-- Types associated with Fields.
type
family
FieldType
(
f
::
Field
)
::
*
where
type
family
FieldType
(
f
::
Field
)
::
*
where
FieldType
ViewModule
=
Text
FieldType
S
.
ViewModule
=
Text
FieldType
ViewName
=
Text
FieldType
S
.
ViewName
=
Text
FieldType
MsgThrottle
=
Integer
FieldType
S
.
MsgThrottle
=
Integer
FieldType
Version
=
Integer
FieldType
S
.
Version
=
Integer
FieldType
DisplayHandler
=
IO
()
FieldType
S
.
DisplayHandler
=
IO
()
FieldType
Visible
=
Bool
FieldType
S
.
Visible
=
Bool
FieldType
CSS
=
[(
Text
,
Text
,
Text
)]
FieldType
S
.
CSS
=
[(
Text
,
Text
,
Text
)]
FieldType
DOMClasses
=
[
Text
]
FieldType
S
.
DOMClasses
=
[
Text
]
FieldType
Width
=
StrInt
FieldType
S
.
Width
=
StrInt
FieldType
Height
=
StrInt
FieldType
S
.
Height
=
StrInt
FieldType
Padding
=
StrInt
FieldType
S
.
Padding
=
StrInt
FieldType
Margin
=
StrInt
FieldType
S
.
Margin
=
StrInt
FieldType
Color
=
Text
FieldType
S
.
Color
=
Text
FieldType
BackgroundColor
=
Text
FieldType
S
.
BackgroundColor
=
Text
FieldType
BorderColor
=
Text
FieldType
S
.
BorderColor
=
Text
FieldType
BorderWidth
=
StrInt
FieldType
S
.
BorderWidth
=
StrInt
FieldType
BorderRadius
=
StrInt
FieldType
S
.
BorderRadius
=
StrInt
FieldType
BorderStyle
=
BorderStyleValue
FieldType
S
.
BorderStyle
=
BorderStyleValue
FieldType
FontStyle
=
FontStyleValue
FieldType
S
.
FontStyle
=
FontStyleValue
FieldType
FontWeight
=
FontWeightValue
FieldType
S
.
FontWeight
=
FontWeightValue
FieldType
FontSize
=
StrInt
FieldType
S
.
FontSize
=
StrInt
FieldType
FontFamily
=
Text
FieldType
S
.
FontFamily
=
Text
FieldType
Description
=
Text
FieldType
S
.
Description
=
Text
FieldType
ClickHandler
=
IO
()
FieldType
S
.
ClickHandler
=
IO
()
FieldType
SubmitHandler
=
IO
()
FieldType
S
.
S
ubmitHandler
=
IO
()
FieldType
Disabled
=
Bool
FieldType
S
.
Disabled
=
Bool
FieldType
StringValue
=
Text
FieldType
S
.
S
tringValue
=
Text
FieldType
Placeholder
=
Text
FieldType
S
.
Placeholder
=
Text
FieldType
Tooltip
=
Text
FieldType
S
.
Tooltip
=
Text
FieldType
Icon
=
Text
FieldType
S
.
Icon
=
Text
FieldType
ButtonStyle
=
ButtonStyleValue
FieldType
S
.
ButtonStyle
=
ButtonStyleValue
FieldType
B64Value
=
Base64
FieldType
S
.
B64Value
=
Base64
FieldType
ImageFormat
=
ImageFormatValue
FieldType
S
.
ImageFormat
=
ImageFormatValue
FieldType
BoolValue
=
Bool
FieldType
S
.
BoolValue
=
Bool
FieldType
Options
=
SelectionOptions
FieldType
S
.
Options
=
SelectionOptions
FieldType
SelectedLabel
=
Text
FieldType
S
.
S
electedLabel
=
Text
FieldType
SelectedValue
=
Text
FieldType
S
.
S
electedValue
=
Text
FieldType
SelectionHandler
=
IO
()
FieldType
S
.
S
electionHandler
=
IO
()
FieldType
Tooltips
=
[
Text
]
FieldType
S
.
Tooltips
=
[
Text
]
FieldType
Icons
=
[
Text
]
FieldType
S
.
Icons
=
[
Text
]
FieldType
SelectedLabels
=
[
Text
]
FieldType
S
.
S
electedLabels
=
[
Text
]
FieldType
SelectedValues
=
[
Text
]
FieldType
S
.
S
electedValues
=
[
Text
]
FieldType
IntValue
=
Integer
FieldType
S
.
IntValue
=
Integer
FieldType
StepInt
=
Integer
FieldType
S
.
S
tepInt
=
Integer
FieldType
MinInt
=
Integer
FieldType
S
.
MinInt
=
Integer
FieldType
MaxInt
=
Integer
FieldType
S
.
MaxInt
=
Integer
FieldType
LowerInt
=
Integer
FieldType
S
.
LowerInt
=
Integer
FieldType
UpperInt
=
Integer
FieldType
S
.
UpperInt
=
Integer
FieldType
IntPairValue
=
(
Integer
,
Integer
)
FieldType
S
.
IntPairValue
=
(
Integer
,
Integer
)
FieldType
Orientation
=
OrientationValue
FieldType
S
.
Orientation
=
OrientationValue
FieldType
ShowRange
=
Bool
FieldType
S
.
S
howRange
=
Bool
FieldType
ReadOut
=
Bool
FieldType
S
.
ReadOut
=
Bool
FieldType
SliderColor
=
Text
FieldType
S
.
S
liderColor
=
Text
FieldType
BarStyle
=
BarStyleValue
FieldType
S
.
BarStyle
=
BarStyleValue
FieldType
FloatValue
=
Double
FieldType
S
.
FloatValue
=
Double
FieldType
StepFloat
=
Double
FieldType
S
.
S
tepFloat
=
Double
FieldType
MinFloat
=
Double
FieldType
S
.
MinFloat
=
Double
FieldType
MaxFloat
=
Double
FieldType
S
.
MaxFloat
=
Double
FieldType
LowerFloat
=
Double
FieldType
S
.
LowerFloat
=
Double
FieldType
UpperFloat
=
Double
FieldType
S
.
UpperFloat
=
Double
FieldType
FloatPairValue
=
(
Double
,
Double
)
FieldType
S
.
FloatPairValue
=
(
Double
,
Double
)
FieldType
ChangeHandler
=
IO
()
FieldType
S
.
ChangeHandler
=
IO
()
FieldType
Children
=
[
ChildWidget
]
FieldType
S
.
Children
=
[
ChildWidget
]
FieldType
OverflowX
=
OverflowValue
FieldType
S
.
OverflowX
=
OverflowValue
FieldType
OverflowY
=
OverflowValue
FieldType
S
.
OverflowY
=
OverflowValue
FieldType
BoxStyle
=
BoxStyleValue
FieldType
S
.
BoxStyle
=
BoxStyleValue
FieldType
Flex
=
Int
FieldType
S
.
Flex
=
Int
FieldType
Pack
=
LocationValue
FieldType
S
.
Pack
=
LocationValue
FieldType
Align
=
LocationValue
FieldType
S
.
Align
=
LocationValue
FieldType
Titles
=
[
Text
]
FieldType
S
.
Titles
=
[
Text
]
FieldType
SelectedIndex
=
Integer
FieldType
S
.
S
electedIndex
=
Integer
-- | Can be used to put different widgets in a list. Useful for dealing with children widgets.
-- | Can be used to put different widgets in a list. Useful for dealing with children widgets.
data
ChildWidget
=
forall
w
.
RecAll
Attr
(
WidgetFields
w
)
ToPairs
=>
ChildWidget
(
IPythonWidget
w
)
data
ChildWidget
=
forall
w
.
RecAll
Attr
(
WidgetFields
w
)
ToPairs
=>
ChildWidget
(
IPythonWidget
w
)
...
@@ -236,32 +238,32 @@ data WidgetType = ButtonType
...
@@ -236,32 +238,32 @@ data WidgetType = ButtonType
-- Fields associated with a widget
-- Fields associated with a widget
type
family
WidgetFields
(
w
::
WidgetType
)
::
[
Field
]
where
type
family
WidgetFields
(
w
::
WidgetType
)
::
[
Field
]
where
WidgetFields
ButtonType
=
DOMWidgetClass
:++
'[
D
escription
,
Tooltip
,
Disabled
,
Icon
,
ButtonStyle
,
ClickHandler
]
WidgetFields
ButtonType
=
DOMWidgetClass
:++
'[
S
.
Description
,
S
.
Tooltip
,
S
.
Disabled
,
S
.
Icon
,
S
.
ButtonStyle
,
S
.
ClickHandler
]
WidgetFields
ImageType
=
DOMWidgetClass
:++
'[
I
mageFormat
,
B64Value
]
WidgetFields
ImageType
=
DOMWidgetClass
:++
'[
S
.
ImageFormat
,
S
.
B64Value
]
WidgetFields
OutputType
=
DOMWidgetClass
WidgetFields
OutputType
=
DOMWidgetClass
WidgetFields
HTMLType
=
StringClass
WidgetFields
HTMLType
=
StringClass
WidgetFields
LatexType
=
StringClass
WidgetFields
LatexType
=
StringClass
WidgetFields
TextType
=
StringClass
:++
'[
S
ubmitHandler
,
ChangeHandler
]
WidgetFields
TextType
=
StringClass
:++
'[
S
.
SubmitHandler
,
S
.
ChangeHandler
]
WidgetFields
TextAreaType
=
StringClass
:++
'[
C
hangeHandler
]
WidgetFields
TextAreaType
=
StringClass
:++
'[
S
.
ChangeHandler
]
WidgetFields
CheckBoxType
=
BoolClass
WidgetFields
CheckBoxType
=
BoolClass
WidgetFields
ToggleButtonType
=
BoolClass
:++
'[
T
ooltip
,
Icon
,
ButtonStyle
]
WidgetFields
ToggleButtonType
=
BoolClass
:++
'[
S
.
Tooltip
,
S
.
Icon
,
S
.
ButtonStyle
]
WidgetFields
DropdownType
=
SelectionClass
:++
'[
B
uttonStyle
]
WidgetFields
DropdownType
=
SelectionClass
:++
'[
S
.
ButtonStyle
]
WidgetFields
RadioButtonsType
=
SelectionClass
WidgetFields
RadioButtonsType
=
SelectionClass
WidgetFields
SelectType
=
SelectionClass
WidgetFields
SelectType
=
SelectionClass
WidgetFields
ToggleButtonsType
=
SelectionClass
:++
'[
T
ooltips
,
Icons
,
ButtonStyle
]
WidgetFields
ToggleButtonsType
=
SelectionClass
:++
'[
S
.
Tooltips
,
S
.
Icons
,
S
.
ButtonStyle
]
WidgetFields
SelectMultipleType
=
MultipleSelectionClass
WidgetFields
SelectMultipleType
=
MultipleSelectionClass
WidgetFields
IntTextType
=
IntClass
WidgetFields
IntTextType
=
IntClass
WidgetFields
BoundedIntTextType
=
BoundedIntClass
WidgetFields
BoundedIntTextType
=
BoundedIntClass
WidgetFields
IntSliderType
=
BoundedIntClass
:++
'[
O
rientation
,
ShowRange
,
ReadOut
,
SliderColor
]
WidgetFields
IntSliderType
=
BoundedIntClass
:++
'[
S
.
Orientation
,
S
.
ShowRange
,
S
.
ReadOut
,
S
.
SliderColor
]
WidgetFields
IntProgressType
=
BoundedIntClass
:++
'[
B
arStyle
]
WidgetFields
IntProgressType
=
BoundedIntClass
:++
'[
S
.
BarStyle
]
WidgetFields
IntRangeSliderType
=
BoundedIntRangeClass
:++
'[
O
rientation
,
ShowRange
,
ReadOut
,
SliderColor
]
WidgetFields
IntRangeSliderType
=
BoundedIntRangeClass
:++
'[
S
.
Orientation
,
S
.
ShowRange
,
S
.
ReadOut
,
S
.
SliderColor
]
WidgetFields
FloatTextType
=
FloatClass
WidgetFields
FloatTextType
=
FloatClass
WidgetFields
BoundedFloatTextType
=
BoundedFloatClass
WidgetFields
BoundedFloatTextType
=
BoundedFloatClass
WidgetFields
FloatSliderType
=
BoundedFloatClass
:++
'[
O
rientation
,
ShowRange
,
ReadOut
,
SliderColor
]
WidgetFields
FloatSliderType
=
BoundedFloatClass
:++
'[
S
.
Orientation
,
S
.
ShowRange
,
S
.
ReadOut
,
S
.
SliderColor
]
WidgetFields
FloatProgressType
=
BoundedFloatClass
:++
'[
B
arStyle
]
WidgetFields
FloatProgressType
=
BoundedFloatClass
:++
'[
S
.
BarStyle
]
WidgetFields
FloatRangeSliderType
=
BoundedFloatRangeClass
:++
'[
O
rientation
,
ShowRange
,
ReadOut
,
SliderColor
]
WidgetFields
FloatRangeSliderType
=
BoundedFloatRangeClass
:++
'[
S
.
Orientation
,
S
.
ShowRange
,
S
.
ReadOut
,
S
.
SliderColor
]
WidgetFields
BoxType
=
BoxClass
WidgetFields
BoxType
=
BoxClass
WidgetFields
FlexBoxType
=
BoxClass
:++
'[
O
rientation
,
Flex
,
Pack
,
Align
]
WidgetFields
FlexBoxType
=
BoxClass
:++
'[
S
.
Orientation
,
S
.
Flex
,
S
.
Pack
,
S
.
Align
]
WidgetFields
AccordionType
=
SelectionContainerClass
WidgetFields
AccordionType
=
SelectionContainerClass
WidgetFields
TabType
=
SelectionContainerClass
WidgetFields
TabType
=
SelectionContainerClass
...
@@ -289,82 +291,82 @@ class ToPairs a where
...
@@ -289,82 +291,82 @@ class ToPairs a where
toPairs
::
a
->
[
Pair
]
toPairs
::
a
->
[
Pair
]
-- Attributes that aren't synced with the frontend give [] on toPairs
-- Attributes that aren't synced with the frontend give [] on toPairs
instance
ToPairs
(
Attr
ViewModule
)
where
toPairs
x
=
[
"_view_module"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
ViewModule
)
where
toPairs
x
=
[
"_view_module"
.=
toJSON
x
]
instance
ToPairs
(
Attr
ViewName
)
where
toPairs
x
=
[
"_view_name"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
ViewName
)
where
toPairs
x
=
[
"_view_name"
.=
toJSON
x
]
instance
ToPairs
(
Attr
MsgThrottle
)
where
toPairs
x
=
[
"msg_throttle"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
MsgThrottle
)
where
toPairs
x
=
[
"msg_throttle"
.=
toJSON
x
]
instance
ToPairs
(
Attr
Version
)
where
toPairs
x
=
[
"version"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
Version
)
where
toPairs
x
=
[
"version"
.=
toJSON
x
]
instance
ToPairs
(
Attr
DisplayHandler
)
where
toPairs
_
=
[]
-- Not sent to the frontend
instance
ToPairs
(
Attr
S
.
DisplayHandler
)
where
toPairs
_
=
[]
-- Not sent to the frontend
instance
ToPairs
(
Attr
Visible
)
where
toPairs
x
=
[
"visible"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
Visible
)
where
toPairs
x
=
[
"visible"
.=
toJSON
x
]
instance
ToPairs
(
Attr
CSS
)
where
toPairs
x
=
[
"_css"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
CSS
)
where
toPairs
x
=
[
"_css"
.=
toJSON
x
]
instance
ToPairs
(
Attr
DOMClasses
)
where
toPairs
x
=
[
"_dom_classes"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
DOMClasses
)
where
toPairs
x
=
[
"_dom_classes"
.=
toJSON
x
]
instance
ToPairs
(
Attr
Width
)
where
toPairs
x
=
[
"width"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
Width
)
where
toPairs
x
=
[
"width"
.=
toJSON
x
]
instance
ToPairs
(
Attr
Height
)
where
toPairs
x
=
[
"height"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
Height
)
where
toPairs
x
=
[
"height"
.=
toJSON
x
]
instance
ToPairs
(
Attr
Padding
)
where
toPairs
x
=
[
"padding"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
Padding
)
where
toPairs
x
=
[
"padding"
.=
toJSON
x
]
instance
ToPairs
(
Attr
Margin
)
where
toPairs
x
=
[
"margin"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
Margin
)
where
toPairs
x
=
[
"margin"
.=
toJSON
x
]
instance
ToPairs
(
Attr
Color
)
where
toPairs
x
=
[
"color"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
Color
)
where
toPairs
x
=
[
"color"
.=
toJSON
x
]
instance
ToPairs
(
Attr
BackgroundColor
)
where
toPairs
x
=
[
"background_color"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
BackgroundColor
)
where
toPairs
x
=
[
"background_color"
.=
toJSON
x
]
instance
ToPairs
(
Attr
BorderColor
)
where
toPairs
x
=
[
"border_color"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
BorderColor
)
where
toPairs
x
=
[
"border_color"
.=
toJSON
x
]
instance
ToPairs
(
Attr
BorderWidth
)
where
toPairs
x
=
[
"border_width"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
BorderWidth
)
where
toPairs
x
=
[
"border_width"
.=
toJSON
x
]
instance
ToPairs
(
Attr
BorderRadius
)
where
toPairs
x
=
[
"border_radius"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
BorderRadius
)
where
toPairs
x
=
[
"border_radius"
.=
toJSON
x
]
instance
ToPairs
(
Attr
BorderStyle
)
where
toPairs
x
=
[
"border_style"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
BorderStyle
)
where
toPairs
x
=
[
"border_style"
.=
toJSON
x
]
instance
ToPairs
(
Attr
FontStyle
)
where
toPairs
x
=
[
"font_style"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
FontStyle
)
where
toPairs
x
=
[
"font_style"
.=
toJSON
x
]
instance
ToPairs
(
Attr
FontWeight
)
where
toPairs
x
=
[
"font_weight"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
FontWeight
)
where
toPairs
x
=
[
"font_weight"
.=
toJSON
x
]
instance
ToPairs
(
Attr
FontSize
)
where
toPairs
x
=
[
"font_size"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
FontSize
)
where
toPairs
x
=
[
"font_size"
.=
toJSON
x
]
instance
ToPairs
(
Attr
FontFamily
)
where
toPairs
x
=
[
"font_family"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
FontFamily
)
where
toPairs
x
=
[
"font_family"
.=
toJSON
x
]
instance
ToPairs
(
Attr
Description
)
where
toPairs
x
=
[
"description"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
Description
)
where
toPairs
x
=
[
"description"
.=
toJSON
x
]
instance
ToPairs
(
Attr
ClickHandler
)
where
toPairs
_
=
[]
-- Not sent to the frontend
instance
ToPairs
(
Attr
S
.
ClickHandler
)
where
toPairs
_
=
[]
-- Not sent to the frontend
instance
ToPairs
(
Attr
SubmitHandler
)
where
toPairs
_
=
[]
-- Not sent to the frontend
instance
ToPairs
(
Attr
S
.
S
ubmitHandler
)
where
toPairs
_
=
[]
-- Not sent to the frontend
instance
ToPairs
(
Attr
Disabled
)
where
toPairs
x
=
[
"disabled"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
Disabled
)
where
toPairs
x
=
[
"disabled"
.=
toJSON
x
]
instance
ToPairs
(
Attr
StringValue
)
where
toPairs
x
=
[
"value"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
S
tringValue
)
where
toPairs
x
=
[
"value"
.=
toJSON
x
]
instance
ToPairs
(
Attr
Placeholder
)
where
toPairs
x
=
[
"placeholder"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
Placeholder
)
where
toPairs
x
=
[
"placeholder"
.=
toJSON
x
]
instance
ToPairs
(
Attr
Tooltip
)
where
toPairs
x
=
[
"tooltip"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
Tooltip
)
where
toPairs
x
=
[
"tooltip"
.=
toJSON
x
]
instance
ToPairs
(
Attr
Icon
)
where
toPairs
x
=
[
"icon"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
Icon
)
where
toPairs
x
=
[
"icon"
.=
toJSON
x
]
instance
ToPairs
(
Attr
ButtonStyle
)
where
toPairs
x
=
[
"button_style"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
ButtonStyle
)
where
toPairs
x
=
[
"button_style"
.=
toJSON
x
]
instance
ToPairs
(
Attr
B64Value
)
where
toPairs
x
=
[
"_b64value"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
B64Value
)
where
toPairs
x
=
[
"_b64value"
.=
toJSON
x
]
instance
ToPairs
(
Attr
ImageFormat
)
where
toPairs
x
=
[
"format"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
ImageFormat
)
where
toPairs
x
=
[
"format"
.=
toJSON
x
]
instance
ToPairs
(
Attr
BoolValue
)
where
toPairs
x
=
[
"value"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
BoolValue
)
where
toPairs
x
=
[
"value"
.=
toJSON
x
]
instance
ToPairs
(
Attr
SelectedLabel
)
where
toPairs
x
=
[
"selected_label"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
S
electedLabel
)
where
toPairs
x
=
[
"selected_label"
.=
toJSON
x
]
instance
ToPairs
(
Attr
SelectedValue
)
where
toPairs
x
=
[
"value"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
S
electedValue
)
where
toPairs
x
=
[
"value"
.=
toJSON
x
]
instance
ToPairs
(
Attr
Options
)
where
instance
ToPairs
(
Attr
S
.
Options
)
where
toPairs
x
=
case
_value
x
of
toPairs
x
=
case
_value
x
of
Dummy
_
->
labels
(
""
::
Text
)
Dummy
_
->
labels
(
""
::
Text
)
Real
(
OptionLabels
xs
)
->
labels
xs
Real
(
OptionLabels
xs
)
->
labels
xs
Real
(
OptionDict
xps
)
->
labels
$
map
fst
xps
Real
(
OptionDict
xps
)
->
labels
$
map
fst
xps
where
labels
xs
=
[
"_options_labels"
.=
xs
]
where
labels
xs
=
[
"_options_labels"
.=
xs
]
instance
ToPairs
(
Attr
SelectionHandler
)
where
toPairs
_
=
[]
-- Not sent to the frontend
instance
ToPairs
(
Attr
S
.
S
electionHandler
)
where
toPairs
_
=
[]
-- Not sent to the frontend
instance
ToPairs
(
Attr
Tooltips
)
where
toPairs
x
=
[
"tooltips"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
Tooltips
)
where
toPairs
x
=
[
"tooltips"
.=
toJSON
x
]
instance
ToPairs
(
Attr
Icons
)
where
toPairs
x
=
[
"icons"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
Icons
)
where
toPairs
x
=
[
"icons"
.=
toJSON
x
]
instance
ToPairs
(
Attr
SelectedLabels
)
where
toPairs
x
=
[
"selected_labels"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
S
electedLabels
)
where
toPairs
x
=
[
"selected_labels"
.=
toJSON
x
]
instance
ToPairs
(
Attr
SelectedValues
)
where
toPairs
x
=
[
"values"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
S
electedValues
)
where
toPairs
x
=
[
"values"
.=
toJSON
x
]
instance
ToPairs
(
Attr
IntValue
)
where
toPairs
x
=
[
"value"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
IntValue
)
where
toPairs
x
=
[
"value"
.=
toJSON
x
]
instance
ToPairs
(
Attr
StepInt
)
where
toPairs
x
=
[
"step"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
S
tepInt
)
where
toPairs
x
=
[
"step"
.=
toJSON
x
]
instance
ToPairs
(
Attr
MinInt
)
where
toPairs
x
=
[
"min"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
MinInt
)
where
toPairs
x
=
[
"min"
.=
toJSON
x
]
instance
ToPairs
(
Attr
MaxInt
)
where
toPairs
x
=
[
"max"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
MaxInt
)
where
toPairs
x
=
[
"max"
.=
toJSON
x
]
instance
ToPairs
(
Attr
IntPairValue
)
where
toPairs
x
=
[
"value"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
IntPairValue
)
where
toPairs
x
=
[
"value"
.=
toJSON
x
]
instance
ToPairs
(
Attr
LowerInt
)
where
toPairs
x
=
[
"min"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
LowerInt
)
where
toPairs
x
=
[
"min"
.=
toJSON
x
]
instance
ToPairs
(
Attr
UpperInt
)
where
toPairs
x
=
[
"max"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
UpperInt
)
where
toPairs
x
=
[
"max"
.=
toJSON
x
]
instance
ToPairs
(
Attr
FloatValue
)
where
toPairs
x
=
[
"value"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
FloatValue
)
where
toPairs
x
=
[
"value"
.=
toJSON
x
]
instance
ToPairs
(
Attr
StepFloat
)
where
toPairs
x
=
[
"step"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
S
tepFloat
)
where
toPairs
x
=
[
"step"
.=
toJSON
x
]
instance
ToPairs
(
Attr
MinFloat
)
where
toPairs
x
=
[
"min"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
MinFloat
)
where
toPairs
x
=
[
"min"
.=
toJSON
x
]
instance
ToPairs
(
Attr
MaxFloat
)
where
toPairs
x
=
[
"max"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
MaxFloat
)
where
toPairs
x
=
[
"max"
.=
toJSON
x
]
instance
ToPairs
(
Attr
FloatPairValue
)
where
toPairs
x
=
[
"value"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
FloatPairValue
)
where
toPairs
x
=
[
"value"
.=
toJSON
x
]
instance
ToPairs
(
Attr
LowerFloat
)
where
toPairs
x
=
[
"min"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
LowerFloat
)
where
toPairs
x
=
[
"min"
.=
toJSON
x
]
instance
ToPairs
(
Attr
UpperFloat
)
where
toPairs
x
=
[
"max"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
UpperFloat
)
where
toPairs
x
=
[
"max"
.=
toJSON
x
]
instance
ToPairs
(
Attr
Orientation
)
where
toPairs
x
=
[
"orientation"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
Orientation
)
where
toPairs
x
=
[
"orientation"
.=
toJSON
x
]
instance
ToPairs
(
Attr
ShowRange
)
where
toPairs
x
=
[
"_range"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
S
howRange
)
where
toPairs
x
=
[
"_range"
.=
toJSON
x
]
instance
ToPairs
(
Attr
ReadOut
)
where
toPairs
x
=
[
"readout"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
ReadOut
)
where
toPairs
x
=
[
"readout"
.=
toJSON
x
]
instance
ToPairs
(
Attr
SliderColor
)
where
toPairs
x
=
[
"slider_color"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
S
liderColor
)
where
toPairs
x
=
[
"slider_color"
.=
toJSON
x
]
instance
ToPairs
(
Attr
BarStyle
)
where
toPairs
x
=
[
"bar_style"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
BarStyle
)
where
toPairs
x
=
[
"bar_style"
.=
toJSON
x
]
instance
ToPairs
(
Attr
ChangeHandler
)
where
toPairs
_
=
[]
-- Not sent to the frontend
instance
ToPairs
(
Attr
S
.
ChangeHandler
)
where
toPairs
_
=
[]
-- Not sent to the frontend
instance
ToPairs
(
Attr
Children
)
where
toPairs
x
=
[
"children"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
Children
)
where
toPairs
x
=
[
"children"
.=
toJSON
x
]
instance
ToPairs
(
Attr
OverflowX
)
where
toPairs
x
=
[
"overflow_x"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
OverflowX
)
where
toPairs
x
=
[
"overflow_x"
.=
toJSON
x
]
instance
ToPairs
(
Attr
OverflowY
)
where
toPairs
x
=
[
"overflow_y"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
OverflowY
)
where
toPairs
x
=
[
"overflow_y"
.=
toJSON
x
]
instance
ToPairs
(
Attr
BoxStyle
)
where
toPairs
x
=
[
"box_style"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
BoxStyle
)
where
toPairs
x
=
[
"box_style"
.=
toJSON
x
]
instance
ToPairs
(
Attr
Flex
)
where
toPairs
x
=
[
"flex"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
Flex
)
where
toPairs
x
=
[
"flex"
.=
toJSON
x
]
instance
ToPairs
(
Attr
Pack
)
where
toPairs
x
=
[
"pack"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
Pack
)
where
toPairs
x
=
[
"pack"
.=
toJSON
x
]
instance
ToPairs
(
Attr
Align
)
where
toPairs
x
=
[
"align"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
Align
)
where
toPairs
x
=
[
"align"
.=
toJSON
x
]
instance
ToPairs
(
Attr
Titles
)
where
toPairs
x
=
[
"_titles"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
Titles
)
where
toPairs
x
=
[
"_titles"
.=
toJSON
x
]
instance
ToPairs
(
Attr
SelectedIndex
)
where
toPairs
x
=
[
"selected_index"
.=
toJSON
x
]
instance
ToPairs
(
Attr
S
.
S
electedIndex
)
where
toPairs
x
=
[
"selected_index"
.=
toJSON
x
]
-- | Store the value for a field, as an object parametrized by the Field. No verification is done
-- | Store the value for a field, as an object parametrized by the Field. No verification is done
-- for these values.
-- for these values.
...
@@ -396,157 +398,157 @@ reflect :: forall (f :: Field). (SingI f, SingKind ('KProxy :: KProxy Field)) =>
...
@@ -396,157 +398,157 @@ reflect :: forall (f :: Field). (SingI f, SingKind ('KProxy :: KProxy Field)) =>
reflect
=
fromSing
reflect
=
fromSing
-- | A record representing an object of the Widget class from IPython
-- | A record representing an object of the Widget class from IPython
defaultWidget
::
FieldType
ViewName
->
Rec
Attr
WidgetClass
defaultWidget
::
FieldType
S
.
ViewName
->
Rec
Attr
WidgetClass
defaultWidget
viewName
=
(
S
ViewModule
=::
""
)
defaultWidget
viewName
=
(
ViewModule
=::
""
)
:&
(
S
ViewName
=::
viewName
)
:&
(
ViewName
=::
viewName
)
:&
(
S
MsgThrottle
=:+
3
)
:&
(
MsgThrottle
=:+
3
)
:&
(
S
Version
=::
0
)
:&
(
Version
=::
0
)
:&
(
S
DisplayHandler
=::
return
()
)
:&
(
DisplayHandler
=::
return
()
)
:&
RNil
:&
RNil
-- | A record representing an object of the DOMWidget class from IPython
-- | A record representing an object of the DOMWidget class from IPython
defaultDOMWidget
::
FieldType
ViewName
->
Rec
Attr
DOMWidgetClass
defaultDOMWidget
::
FieldType
S
.
ViewName
->
Rec
Attr
DOMWidgetClass
defaultDOMWidget
viewName
=
defaultWidget
viewName
<+>
domAttrs
defaultDOMWidget
viewName
=
defaultWidget
viewName
<+>
domAttrs
where
domAttrs
=
(
S
Visible
=::
True
)
where
domAttrs
=
(
Visible
=::
True
)
:&
(
S
CSS
=::
[]
)
:&
(
CSS
=::
[]
)
:&
(
S
DOMClasses
=::
[]
)
:&
(
DOMClasses
=::
[]
)
:&
(
S
Width
=:+
0
)
:&
(
Width
=:+
0
)
:&
(
S
Height
=:+
0
)
:&
(
Height
=:+
0
)
:&
(
S
Padding
=:+
0
)
:&
(
Padding
=:+
0
)
:&
(
S
Margin
=:+
0
)
:&
(
Margin
=:+
0
)
:&
(
S
Color
=::
""
)
:&
(
Color
=::
""
)
:&
(
S
BackgroundColor
=::
""
)
:&
(
BackgroundColor
=::
""
)
:&
(
S
BorderColor
=::
""
)
:&
(
BorderColor
=::
""
)
:&
(
S
BorderWidth
=:+
0
)
:&
(
BorderWidth
=:+
0
)
:&
(
S
BorderRadius
=:+
0
)
:&
(
BorderRadius
=:+
0
)
:&
(
S
BorderStyle
=::
DefaultBorder
)
:&
(
BorderStyle
=::
DefaultBorder
)
:&
(
S
FontStyle
=::
DefaultFont
)
:&
(
FontStyle
=::
DefaultFont
)
:&
(
S
FontWeight
=::
DefaultWeight
)
:&
(
FontWeight
=::
DefaultWeight
)
:&
(
S
FontSize
=:+
0
)
:&
(
FontSize
=:+
0
)
:&
(
S
FontFamily
=::
""
)
:&
(
FontFamily
=::
""
)
:&
RNil
:&
RNil
-- | A record representing a widget of the _String class from IPython
-- | A record representing a widget of the _String class from IPython
defaultStringWidget
::
FieldType
ViewName
->
Rec
Attr
StringClass
defaultStringWidget
::
FieldType
S
.
ViewName
->
Rec
Attr
StringClass
defaultStringWidget
viewName
=
defaultDOMWidget
viewName
<+>
strAttrs
defaultStringWidget
viewName
=
defaultDOMWidget
viewName
<+>
strAttrs
where
strAttrs
=
(
S
S
tringValue
=::
""
)
where
strAttrs
=
(
StringValue
=::
""
)
:&
(
S
Disabled
=::
False
)
:&
(
Disabled
=::
False
)
:&
(
S
Description
=::
""
)
:&
(
Description
=::
""
)
:&
(
S
Placeholder
=::
""
)
:&
(
Placeholder
=::
""
)
:&
RNil
:&
RNil
-- | A record representing a widget of the _Bool class from IPython
-- | A record representing a widget of the _Bool class from IPython
defaultBoolWidget
::
FieldType
ViewName
->
Rec
Attr
BoolClass
defaultBoolWidget
::
FieldType
S
.
ViewName
->
Rec
Attr
BoolClass
defaultBoolWidget
viewName
=
defaultDOMWidget
viewName
<+>
boolAttrs
defaultBoolWidget
viewName
=
defaultDOMWidget
viewName
<+>
boolAttrs
where
boolAttrs
=
(
S
BoolValue
=::
False
)
where
boolAttrs
=
(
BoolValue
=::
False
)
:&
(
S
Disabled
=::
False
)
:&
(
Disabled
=::
False
)
:&
(
S
Description
=::
""
)
:&
(
Description
=::
""
)
:&
(
S
ChangeHandler
=::
return
()
)
:&
(
ChangeHandler
=::
return
()
)
:&
RNil
:&
RNil
-- | A record representing a widget of the _Selection class from IPython
-- | A record representing a widget of the _Selection class from IPython
defaultSelectionWidget
::
FieldType
ViewName
->
Rec
Attr
SelectionClass
defaultSelectionWidget
::
FieldType
S
.
ViewName
->
Rec
Attr
SelectionClass
defaultSelectionWidget
viewName
=
defaultDOMWidget
viewName
<+>
selectionAttrs
defaultSelectionWidget
viewName
=
defaultDOMWidget
viewName
<+>
selectionAttrs
where
selectionAttrs
=
(
S
Options
=::
OptionLabels
[]
)
where
selectionAttrs
=
(
Options
=::
OptionLabels
[]
)
:&
(
S
S
electedValue
=::
""
)
:&
(
SelectedValue
=::
""
)
:&
(
S
S
electedLabel
=::
""
)
:&
(
SelectedLabel
=::
""
)
:&
(
S
Disabled
=::
False
)
:&
(
Disabled
=::
False
)
:&
(
S
Description
=::
""
)
:&
(
Description
=::
""
)
:&
(
S
S
electionHandler
=::
return
()
)
:&
(
SelectionHandler
=::
return
()
)
:&
RNil
:&
RNil
-- | A record representing a widget of the _MultipleSelection class from IPython
-- | A record representing a widget of the _MultipleSelection class from IPython
defaultMultipleSelectionWidget
::
FieldType
ViewName
->
Rec
Attr
MultipleSelectionClass
defaultMultipleSelectionWidget
::
FieldType
S
.
ViewName
->
Rec
Attr
MultipleSelectionClass
defaultMultipleSelectionWidget
viewName
=
defaultDOMWidget
viewName
<+>
mulSelAttrs
defaultMultipleSelectionWidget
viewName
=
defaultDOMWidget
viewName
<+>
mulSelAttrs
where
mulSelAttrs
=
(
S
Options
=::
OptionLabels
[]
)
where
mulSelAttrs
=
(
Options
=::
OptionLabels
[]
)
:&
(
S
S
electedLabels
=::
[]
)
:&
(
SelectedLabels
=::
[]
)
:&
(
S
S
electedValues
=::
[]
)
:&
(
SelectedValues
=::
[]
)
:&
(
S
Disabled
=::
False
)
:&
(
Disabled
=::
False
)
:&
(
S
Description
=::
""
)
:&
(
Description
=::
""
)
:&
(
S
S
electionHandler
=::
return
()
)
:&
(
SelectionHandler
=::
return
()
)
:&
RNil
:&
RNil
-- | A record representing a widget of the _Int class from IPython
-- | A record representing a widget of the _Int class from IPython
defaultIntWidget
::
FieldType
ViewName
->
Rec
Attr
IntClass
defaultIntWidget
::
FieldType
S
.
ViewName
->
Rec
Attr
IntClass
defaultIntWidget
viewName
=
defaultDOMWidget
viewName
<+>
intAttrs
defaultIntWidget
viewName
=
defaultDOMWidget
viewName
<+>
intAttrs
where
intAttrs
=
(
S
IntValue
=::
0
)
where
intAttrs
=
(
IntValue
=::
0
)
:&
(
S
Disabled
=::
False
)
:&
(
Disabled
=::
False
)
:&
(
S
Description
=::
""
)
:&
(
Description
=::
""
)
:&
(
S
ChangeHandler
=::
return
()
)
:&
(
ChangeHandler
=::
return
()
)
:&
RNil
:&
RNil
-- | A record representing a widget of the _BoundedInt class from IPython
-- | A record representing a widget of the _BoundedInt class from IPython
defaultBoundedIntWidget
::
FieldType
ViewName
->
Rec
Attr
BoundedIntClass
defaultBoundedIntWidget
::
FieldType
S
.
ViewName
->
Rec
Attr
BoundedIntClass
defaultBoundedIntWidget
viewName
=
defaultIntWidget
viewName
<+>
boundedIntAttrs
defaultBoundedIntWidget
viewName
=
defaultIntWidget
viewName
<+>
boundedIntAttrs
where
boundedIntAttrs
=
(
S
S
tepInt
=::
1
)
where
boundedIntAttrs
=
(
StepInt
=::
1
)
:&
(
S
MinInt
=::
0
)
:&
(
MinInt
=::
0
)
:&
(
S
MaxInt
=::
100
)
:&
(
MaxInt
=::
100
)
:&
RNil
:&
RNil
-- | A record representing a widget of the _BoundedInt class from IPython
-- | A record representing a widget of the _BoundedInt class from IPython
defaultIntRangeWidget
::
FieldType
ViewName
->
Rec
Attr
IntRangeClass
defaultIntRangeWidget
::
FieldType
S
.
ViewName
->
Rec
Attr
IntRangeClass
defaultIntRangeWidget
viewName
=
defaultIntWidget
viewName
<+>
rangeAttrs
defaultIntRangeWidget
viewName
=
defaultIntWidget
viewName
<+>
rangeAttrs
where
rangeAttrs
=
(
S
IntPairValue
=::
(
25
,
75
))
where
rangeAttrs
=
(
IntPairValue
=::
(
25
,
75
))
:&
(
S
LowerInt
=::
0
)
:&
(
LowerInt
=::
0
)
:&
(
S
UpperInt
=::
100
)
:&
(
UpperInt
=::
100
)
:&
RNil
:&
RNil
-- | A record representing a widget of the _BoundedIntRange class from IPython
-- | A record representing a widget of the _BoundedIntRange class from IPython
defaultBoundedIntRangeWidget
::
FieldType
ViewName
->
Rec
Attr
BoundedIntRangeClass
defaultBoundedIntRangeWidget
::
FieldType
S
.
ViewName
->
Rec
Attr
BoundedIntRangeClass
defaultBoundedIntRangeWidget
viewName
=
defaultIntRangeWidget
viewName
<+>
boundedIntRangeAttrs
defaultBoundedIntRangeWidget
viewName
=
defaultIntRangeWidget
viewName
<+>
boundedIntRangeAttrs
where
boundedIntRangeAttrs
=
(
S
S
tepInt
=:+
1
)
where
boundedIntRangeAttrs
=
(
StepInt
=:+
1
)
:&
(
S
MinInt
=::
0
)
:&
(
MinInt
=::
0
)
:&
(
S
MaxInt
=::
100
)
:&
(
MaxInt
=::
100
)
:&
RNil
:&
RNil
-- | A record representing a widget of the _Float class from IPython
-- | A record representing a widget of the _Float class from IPython
defaultFloatWidget
::
FieldType
ViewName
->
Rec
Attr
FloatClass
defaultFloatWidget
::
FieldType
S
.
ViewName
->
Rec
Attr
FloatClass
defaultFloatWidget
viewName
=
defaultDOMWidget
viewName
<+>
intAttrs
defaultFloatWidget
viewName
=
defaultDOMWidget
viewName
<+>
intAttrs
where
intAttrs
=
(
S
FloatValue
=::
0
)
where
intAttrs
=
(
FloatValue
=::
0
)
:&
(
S
Disabled
=::
False
)
:&
(
Disabled
=::
False
)
:&
(
S
Description
=::
""
)
:&
(
Description
=::
""
)
:&
(
S
ChangeHandler
=::
return
()
)
:&
(
ChangeHandler
=::
return
()
)
:&
RNil
:&
RNil
-- | A record representing a widget of the _BoundedFloat class from IPython
-- | A record representing a widget of the _BoundedFloat class from IPython
defaultBoundedFloatWidget
::
FieldType
ViewName
->
Rec
Attr
BoundedFloatClass
defaultBoundedFloatWidget
::
FieldType
S
.
ViewName
->
Rec
Attr
BoundedFloatClass
defaultBoundedFloatWidget
viewName
=
defaultFloatWidget
viewName
<+>
boundedFloatAttrs
defaultBoundedFloatWidget
viewName
=
defaultFloatWidget
viewName
<+>
boundedFloatAttrs
where
boundedFloatAttrs
=
(
S
S
tepFloat
=:+
1
)
where
boundedFloatAttrs
=
(
StepFloat
=:+
1
)
:&
(
S
MinFloat
=::
0
)
:&
(
MinFloat
=::
0
)
:&
(
S
MaxFloat
=::
100
)
:&
(
MaxFloat
=::
100
)
:&
RNil
:&
RNil
-- | A record representing a widget of the _BoundedFloat class from IPython
-- | A record representing a widget of the _BoundedFloat class from IPython
defaultFloatRangeWidget
::
FieldType
ViewName
->
Rec
Attr
FloatRangeClass
defaultFloatRangeWidget
::
FieldType
S
.
ViewName
->
Rec
Attr
FloatRangeClass
defaultFloatRangeWidget
viewName
=
defaultFloatWidget
viewName
<+>
rangeAttrs
defaultFloatRangeWidget
viewName
=
defaultFloatWidget
viewName
<+>
rangeAttrs
where
rangeAttrs
=
(
S
FloatPairValue
=::
(
25
,
75
))
where
rangeAttrs
=
(
FloatPairValue
=::
(
25
,
75
))
:&
(
S
LowerFloat
=::
0
)
:&
(
LowerFloat
=::
0
)
:&
(
S
UpperFloat
=::
100
)
:&
(
UpperFloat
=::
100
)
:&
RNil
:&
RNil
-- | A record representing a widget of the _BoundedFloatRange class from IPython
-- | A record representing a widget of the _BoundedFloatRange class from IPython
defaultBoundedFloatRangeWidget
::
FieldType
ViewName
->
Rec
Attr
BoundedFloatRangeClass
defaultBoundedFloatRangeWidget
::
FieldType
S
.
ViewName
->
Rec
Attr
BoundedFloatRangeClass
defaultBoundedFloatRangeWidget
viewName
=
defaultFloatRangeWidget
viewName
<+>
boundedFloatRangeAttrs
defaultBoundedFloatRangeWidget
viewName
=
defaultFloatRangeWidget
viewName
<+>
boundedFloatRangeAttrs
where
boundedFloatRangeAttrs
=
(
S
S
tepFloat
=:+
1
)
where
boundedFloatRangeAttrs
=
(
StepFloat
=:+
1
)
:&
(
S
MinFloat
=::
0
)
:&
(
MinFloat
=::
0
)
:&
(
S
MaxFloat
=::
100
)
:&
(
MaxFloat
=::
100
)
:&
RNil
:&
RNil
-- | A record representing a widget of the _Box class from IPython
-- | A record representing a widget of the _Box class from IPython
defaultBoxWidget
::
FieldType
ViewName
->
Rec
Attr
BoxClass
defaultBoxWidget
::
FieldType
S
.
ViewName
->
Rec
Attr
BoxClass
defaultBoxWidget
viewName
=
defaultDOMWidget
viewName
<+>
boxAttrs
defaultBoxWidget
viewName
=
defaultDOMWidget
viewName
<+>
boxAttrs
where
boxAttrs
=
(
S
Children
=::
[]
)
where
boxAttrs
=
(
Children
=::
[]
)
:&
(
S
OverflowX
=::
DefaultOverflow
)
:&
(
OverflowX
=::
DefaultOverflow
)
:&
(
S
OverflowY
=::
DefaultOverflow
)
:&
(
OverflowY
=::
DefaultOverflow
)
:&
(
S
BoxStyle
=::
DefaultBox
)
:&
(
BoxStyle
=::
DefaultBox
)
:&
RNil
:&
RNil
-- | A record representing a widget of the _SelectionContainer class from IPython
-- | A record representing a widget of the _SelectionContainer class from IPython
defaultSelectionContainerWidget
::
FieldType
ViewName
->
Rec
Attr
SelectionContainerClass
defaultSelectionContainerWidget
::
FieldType
S
.
ViewName
->
Rec
Attr
SelectionContainerClass
defaultSelectionContainerWidget
viewName
=
defaultBoxWidget
viewName
<+>
selAttrs
defaultSelectionContainerWidget
viewName
=
defaultBoxWidget
viewName
<+>
selAttrs
where
selAttrs
=
(
S
Titles
=::
[]
)
where
selAttrs
=
(
Titles
=::
[]
)
:&
(
S
S
electedIndex
=::
0
)
:&
(
SelectedIndex
=::
0
)
:&
(
S
ChangeHandler
=::
return
()
)
:&
(
ChangeHandler
=::
return
()
)
:&
RNil
:&
RNil
newtype
WidgetState
w
=
WidgetState
{
_getState
::
Rec
Attr
(
WidgetFields
w
)
}
newtype
WidgetState
w
=
WidgetState
{
_getState
::
Rec
Attr
(
WidgetFields
w
)
}
...
@@ -592,12 +594,12 @@ getField widget sfield = unwrap . _value <$> getAttr widget sfield
...
@@ -592,12 +594,12 @@ getField widget sfield = unwrap . _value <$> getAttr widget sfield
str
::
String
->
String
str
::
String
->
String
str
=
id
str
=
id
properties
::
IPythonWidget
w
->
IO
[
Field
]
properties
::
IPythonWidget
w
->
IO
()
properties
widget
=
do
properties
widget
=
do
st
<-
readIORef
$
state
widget
st
<-
readIORef
$
state
widget
let
convert
::
Attr
f
->
Const
Field
f
let
convert
::
Attr
f
->
Const
Field
f
convert
attr
=
Const
{
getConst
=
_field
attr
}
convert
attr
=
Const
{
getConst
=
_field
attr
}
return
$
recordToList
.
rmap
convert
.
_getState
$
st
mapM_
print
$
recordToList
.
rmap
convert
.
_getState
$
st
-- Helper function for widget to enforce their inability to fetch console input
-- Helper function for widget to enforce their inability to fetch console input
noStdin
::
IO
a
->
IO
()
noStdin
::
IO
a
->
IO
()
...
@@ -617,17 +619,17 @@ noStdin action =
...
@@ -617,17 +619,17 @@ noStdin action =
triggerEvent
::
(
FieldType
f
~
IO
()
,
f
∈
WidgetFields
w
)
=>
SField
f
->
IPythonWidget
w
->
IO
()
triggerEvent
::
(
FieldType
f
~
IO
()
,
f
∈
WidgetFields
w
)
=>
SField
f
->
IPythonWidget
w
->
IO
()
triggerEvent
sfield
w
=
noStdin
.
join
$
getField
w
sfield
triggerEvent
sfield
w
=
noStdin
.
join
$
getField
w
sfield
triggerChange
::
(
ChangeHandler
∈
WidgetFields
w
)
=>
IPythonWidget
w
->
IO
()
triggerChange
::
(
S
.
ChangeHandler
∈
WidgetFields
w
)
=>
IPythonWidget
w
->
IO
()
triggerChange
=
triggerEvent
S
ChangeHandler
triggerChange
=
triggerEvent
ChangeHandler
triggerClick
::
(
ClickHandler
∈
WidgetFields
w
)
=>
IPythonWidget
w
->
IO
()
triggerClick
::
(
S
.
ClickHandler
∈
WidgetFields
w
)
=>
IPythonWidget
w
->
IO
()
triggerClick
=
triggerEvent
S
ClickHandler
triggerClick
=
triggerEvent
ClickHandler
triggerSelection
::
(
SelectionHandler
∈
WidgetFields
w
)
=>
IPythonWidget
w
->
IO
()
triggerSelection
::
(
S
.
S
electionHandler
∈
WidgetFields
w
)
=>
IPythonWidget
w
->
IO
()
triggerSelection
=
triggerEvent
S
S
electionHandler
triggerSelection
=
triggerEvent
SelectionHandler
triggerSubmit
::
(
SubmitHandler
∈
WidgetFields
w
)
=>
IPythonWidget
w
->
IO
()
triggerSubmit
::
(
S
.
S
ubmitHandler
∈
WidgetFields
w
)
=>
IPythonWidget
w
->
IO
()
triggerSubmit
=
triggerEvent
S
S
ubmitHandler
triggerSubmit
=
triggerEvent
SubmitHandler
triggerDisplay
::
(
DisplayHandler
∈
WidgetFields
w
)
=>
IPythonWidget
w
->
IO
()
triggerDisplay
::
(
S
.
DisplayHandler
∈
WidgetFields
w
)
=>
IPythonWidget
w
->
IO
()
triggerDisplay
=
triggerEvent
S
DisplayHandler
triggerDisplay
=
triggerEvent
DisplayHandler
verify_formatting.py
View file @
6622b260
...
@@ -54,7 +54,7 @@ for source_dir in ["src", "ipython-kernel", "ihaskell-display"]:
...
@@ -54,7 +54,7 @@ for source_dir in ["src", "ipython-kernel", "ihaskell-display"]:
if
"ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets"
in
root
:
if
"ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets"
in
root
:
# Ignore Types.hs and Common.hs from ihaskell-widgets
# Ignore Types.hs and Common.hs from ihaskell-widgets
# They cause issues with hindent, due to promoted types
# They cause issues with hindent, due to promoted types
ignored_files
=
[
"Types.hs"
,
"Common.hs"
]
ignored_files
=
[
"Types.hs"
,
"Common.hs"
,
"Singletons.hs"
]
else
:
else
:
# Take Haskell files, but ignore the Cabal Setup.hs
# Take Haskell files, but ignore the Cabal Setup.hs
# Also ignore IHaskellPrelude.hs, it uses CPP in weird places
# Also ignore IHaskellPrelude.hs, it uses CPP in weird places
...
...
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