| Copyright | (c) Aleksandr Penskoi 2021 |
|---|---|
| License | BSD3 |
| Maintainer | aleksandr.penskoi@gmail.com |
| Stability | experimental |
| Safe Haskell | None |
| Language | Haskell2010 |
NITTA.UIBackend.ViewHelper
Contents
Description
We can not autogenerate ToJSON implementation for some types, so we add helper
types for doing that automatically. Why do we need to generate ToJSON
automatically? We don't want to achieve consistency between client and server
manually.
Synopsis
- module NITTA.UIBackend.ViewHelperCls
- module NITTA.Model.Problems.ViewHelper
- data FView = FView {}
- class Viewable t v | t -> v where
- view :: t -> v
- viewNodeTree :: (Enum b, Num b, NextTick u b) => Tree (TargetSystem u tag1 v1 x1 t1) tag2 v2 x2 t2 -> IO (TreeView ShortNodeView)
- data TreeView a
- data ShortNodeView
- data NodeView tag v x t
- newtype StepInfoView = StepInfoView Text
- type VarValTimeJSON v x t = (VarValTime v x t, ToJSONKey v, ToJSON v, ToJSON x, ToJSON t)
Documentation
Helper for JSON serialization
Instances
| ToJSON FView Source # | |||||
| Generic FView Source # | |||||
Defined in NITTA.Intermediate.Types Associated Types
| |||||
| Show FView Source # | |||||
| Viewable (F v x) FView Source # | |||||
| type Rep FView Source # | |||||
Defined in NITTA.Intermediate.Types type Rep FView = D1 ('MetaData "FView" "NITTA.Intermediate.Types" "nitta-0.0.0.1-2dQF5ldSkqNJVFHdZuKzaq" 'False) (C1 ('MetaCons "FView" 'PrefixI 'True) (S1 ('MetaSel ('Just "fvFun") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "fvHistory") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text]))) | |||||
class Viewable t v | t -> v where Source #
Type class of helpers required for autogeneration of ToJSON and typescript types.
Instances
viewNodeTree :: (Enum b, Num b, NextTick u b) => Tree (TargetSystem u tag1 v1 x1 t1) tag2 v2 x2 t2 -> IO (TreeView ShortNodeView) Source #
Instances
data ShortNodeView Source #
Instances
| ToJSON ShortNodeView Source # | |||||
Defined in NITTA.UIBackend.ViewHelper Methods toJSON :: ShortNodeView -> Value # toEncoding :: ShortNodeView -> Encoding # toJSONList :: [ShortNodeView] -> Value # toEncodingList :: [ShortNodeView] -> Encoding # omitField :: ShortNodeView -> Bool # | |||||
| Generic ShortNodeView Source # | |||||
Defined in NITTA.UIBackend.ViewHelper Associated Types
| |||||
| Show ShortNodeView Source # | |||||
Defined in NITTA.UIBackend.ViewHelper Methods showsPrec :: Int -> ShortNodeView -> ShowS # show :: ShortNodeView -> String # showList :: [ShortNodeView] -> ShowS # | |||||
| ToSample (TreeView ShortNodeView) Source # | |||||
Defined in NITTA.UIBackend.ViewHelper Methods toSamples :: Proxy (TreeView ShortNodeView) -> [(Text, TreeView ShortNodeView)] # | |||||
| type Rep ShortNodeView Source # | |||||
Defined in NITTA.UIBackend.ViewHelper type Rep ShortNodeView = D1 ('MetaData "ShortNodeView" "NITTA.UIBackend.ViewHelper" "nitta-0.0.0.1-2dQF5ldSkqNJVFHdZuKzaq" 'False) (C1 ('MetaCons "ShortNodeView" 'PrefixI 'True) ((S1 ('MetaSel ('Just "sid") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "isTerminal") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "isFinish") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))) :*: ((S1 ('MetaSel ('Just "isProcessed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "duration") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "score") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Float) :*: S1 ('MetaSel ('Just "decsionType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))))) | |||||
data NodeView tag v x t Source #
Instances
| (VarValTimeJSON v x t, ToJSON tag) => ToJSON (NodeView tag v x t) Source # | |||||
| Generic (NodeView tag v x t) Source # | |||||
Defined in NITTA.UIBackend.ViewHelper Associated Types
| |||||
| ToSample (NodeView tag v x t) Source # | |||||
| (UnitTag tag, VarValTimeJSON v x t) => Viewable (DefTree tag v x t) (NodeView tag v x t) Source # | |||||
| type Rep (NodeView tag v x t) Source # | |||||
Defined in NITTA.UIBackend.ViewHelper type Rep (NodeView tag v x t) = D1 ('MetaData "NodeView" "NITTA.UIBackend.ViewHelper" "nitta-0.0.0.1-2dQF5ldSkqNJVFHdZuKzaq" 'False) (C1 ('MetaCons "NodeView" 'PrefixI 'True) (((S1 ('MetaSel ('Just "sid") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "isTerminal") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "isFinish") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "duration") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))) :*: ((S1 ('MetaSel ('Just "parameters") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value) :*: S1 ('MetaSel ('Just "decision") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 DecisionView)) :*: (S1 ('MetaSel ('Just "score") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Float) :*: S1 ('MetaSel ('Just "scores") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value))))) | |||||
newtype StepInfoView Source #
Constructors
| StepInfoView Text |
Instances
| ToJSON StepInfoView Source # | |||||
Defined in NITTA.UIBackend.ViewHelper Methods toJSON :: StepInfoView -> Value # toEncoding :: StepInfoView -> Encoding # toJSONList :: [StepInfoView] -> Value # toEncodingList :: [StepInfoView] -> Encoding # omitField :: StepInfoView -> Bool # | |||||
| Generic StepInfoView Source # | |||||
Defined in NITTA.UIBackend.ViewHelper Associated Types
| |||||
| Time t => ToSample (Process t StepInfoView) Source # | |||||
Defined in NITTA.UIBackend.REST Methods toSamples :: Proxy (Process t StepInfoView) -> [(Text, Process t StepInfoView)] # | |||||
| (Var v, Time t) => Viewable (Process t (StepInfo v x t)) (Process t StepInfoView) Source # | |||||
Defined in NITTA.UIBackend.ViewHelper | |||||
| (Var v, Time t) => Viewable (StepInfo v x t) StepInfoView Source # | |||||
Defined in NITTA.UIBackend.ViewHelper Methods view :: StepInfo v x t -> StepInfoView Source # | |||||
| type Rep StepInfoView Source # | |||||
Defined in NITTA.UIBackend.ViewHelper type Rep StepInfoView = D1 ('MetaData "StepInfoView" "NITTA.UIBackend.ViewHelper" "nitta-0.0.0.1-2dQF5ldSkqNJVFHdZuKzaq" 'True) (C1 ('MetaCons "StepInfoView" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))) | |||||
type VarValTimeJSON v x t = (VarValTime v x t, ToJSONKey v, ToJSON v, ToJSON x, ToJSON t) Source #
Orphan instances
| ToJSON TreeInfo Source # | |
| ToSample TreeInfo Source # | |
| ToSample Integer Source # | |
| (ToJSONKey v, ToJSON v, ToJSON x) => ToJSON (TestbenchReport v x) Source # | |
Methods toJSON :: TestbenchReport v x -> Value # toEncoding :: TestbenchReport v x -> Encoding # toJSONList :: [TestbenchReport v x] -> Value # toEncodingList :: [TestbenchReport v x] -> Encoding # omitField :: TestbenchReport v x -> Bool # | |
| ToSample (TestbenchReport String Int) Source # | |
Methods toSamples :: Proxy (TestbenchReport String Int) -> [(Text, TestbenchReport String Int)] # | |
| (Var v, Time t) => Viewable (Process t (StepInfo v x t)) (Process t StepInfoView) Source # | |
| (Var v, Time t) => Viewable (StepInfo v x t) StepInfoView Source # | |
Methods view :: StepInfo v x t -> StepInfoView Source # | |
| (UnitTag tag, VarValTimeJSON v x t) => Viewable (DefTree tag v x t) (NodeView tag v x t) Source # | |