]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Core.hs
[CLEAN] before adding Continuation FlowList type
[gargantext.git] / src / Gargantext / Core.hs
1 {-|
2 Module : Gargantext.Core
3 Description : Supported Natural language
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10 -}
11
12 module Gargantext.Core
13 where
14
15 import Gargantext.Prelude
16 import GHC.Generics (Generic)
17 import Data.Aeson
18 import Data.Either(Either(Left))
19 import Data.Swagger
20 import Servant.API
21 ------------------------------------------------------------------------
22 -- | Language of a Text
23 -- For simplicity, we suppose text has an homogenous language
24 --
25 -- Next steps: | DE | IT | SP
26 --
27 -- - EN == english
28 -- - FR == french
29 -- - DE == deutch (not implemented yet)
30 -- - IT == italian (not implemented yet)
31 -- - SP == spanish (not implemented yet)
32 --
33 -- ... add your language and help us to implement it (:
34
35 -- | All languages supported
36 -- TODO : DE | SP | CH
37 data Lang = EN | FR | All
38 deriving (Show, Eq, Ord, Bounded, Enum, Generic)
39
40 instance ToJSON Lang
41 instance FromJSON Lang
42 instance ToSchema Lang
43 instance FromHttpApiData Lang
44 where
45 parseUrlPiece "EN" = pure EN
46 parseUrlPiece "FR" = pure FR
47 parseUrlPiece "All" = pure All
48 parseUrlPiece _ = Left "Unexpected value of OrderBy"
49 allLangs :: [Lang]
50 allLangs = [minBound ..]