Add Show instances for Mode, OrderByDirection and ColumnName

parent 1391a677
......@@ -3,6 +3,8 @@ module Gargantext.Components.Table where
import Data.Array (filter)
import Data.Maybe (Maybe(..), maybe)
import Data.Either (Either(..))
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Effect (Effect)
import Effect.Class (liftEffect)
import React (ReactElement, ReactClass, Children, createElement)
......@@ -31,6 +33,11 @@ type Params = { offset :: Int, limit :: Int, orderBy :: OrderBy }
newtype ColumnName = ColumnName String
derive instance genericColumnName :: Generic ColumnName _
instance showColumnName :: Show ColumnName where
show = genericShow
derive instance eqColumnName :: Eq ColumnName
columnName :: ColumnName -> String
......@@ -38,6 +45,11 @@ columnName (ColumnName c) = c
data OrderByDirection a = ASC a | DESC a
derive instance genericOrderByDirection :: Generic (OrderByDirection a) _
instance showOrderByDirection :: Show a => Show (OrderByDirection a) where
show = genericShow
derive instance eqOrderByDirection :: Eq a => Eq (OrderByDirection a)
type Props' =
......
......@@ -8,6 +8,8 @@ import Data.Either (Either(..))
import Data.Foldable
import Data.FoldableWithIndex
import Data.FunctorWithIndex
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Data.Newtype (class Newtype, unwrap)
import Data.Lens (Lens', Prism', Iso', lens, over, prism, (^.), (^..), (%~), (.=), use, (<>~))
import Data.Lens.Common (_Just)
......@@ -295,6 +297,11 @@ data Action
data Mode = Authors | Sources | Institutes | Terms
derive instance genericMode :: Generic Mode _
instance showMode :: Show Mode where
show = genericShow
derive instance eqMode :: Eq Mode
type Dispatch = Action -> Effect Unit
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment