Commit 540456ba authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] Tree type and errors message in Date parsing.

parent b35ca24c
...@@ -2,19 +2,19 @@ ...@@ -2,19 +2,19 @@
-- --
-- see: https://github.com/sol/hpack -- see: https://github.com/sol/hpack
-- --
-- hash: d9ae37baf58628321e1cf53c125f895c9fd3ff19c03fdfaa1ca9b7754fecabf9 -- hash: 985d1caa67e769a2e15fc68e773e608d91e773a04b50f82bcdb4a3997debc1a6
name: gargantext name: gargantext
version: 0.1.0.0 version: 0.1.0.0
synopsis: Deep (Collaborative) Text mining project synopsis: Deep (Collaborative) Text mining project
description: Please see README.md description: Please see README.md
homepage: http://gargantext.org homepage: https://gargantext.org
license: BSD3 license: BSD3
license-file: LICENSE license-file: LICENSE
author: Alexandre Delanoë author: Alexandre Delanoë
maintainer: gargantext@iscpif.fr maintainer: team@gargantext.org
copyright: Copyright: (c) 2016, copyright: Copyright: (c) 2016,
2017 CNRS Alexandre Delanoë 2018 CNRS Alexandre Delanoë
category: Data category: Data
build-type: Simple build-type: Simple
cabal-version: >= 1.10 cabal-version: >= 1.10
......
{-| {-|
Module : Data.Gargantext.Parsers.Date Module : Data.Gargantext.Parsers.Date
Description : Some utils to parse dates Description : Some utils to parse dates
Copyright : (c) CNRS 2017 Copyright : (c) CNRS 2017-present
License : AGPL + CECILL v3 License : AGPL + CECILL v3
Maintainer : dev@gargantext.org Maintainer : team@gargantext.org
Stability : experimental Stability : experimental
Portability : POSIX Portability : POSIX
According to the language of the text, parseDate1 returns date as Text: According to the language of the text, parseDate1 returns date as Text:
TODO : Add some tests TODO : Add some tests
import Data.Gargantext.Parsers as DGP import Data.Gargantext.Parsers.Date as DGP
DGP.parseDate1 DGP.FR "12 avril 2010" == "2010-04-12T00:00:00.000+00:00" DGP.parseDate1 DGP.FR "12 avril 2010" == "2010-04-12T00:00:00.000+00:00"
-} -}
...@@ -60,10 +60,9 @@ parseDate1 lang text = do ...@@ -60,10 +60,9 @@ parseDate1 lang text = do
case headMay maybeJson of case headMay maybeJson of
Just (Json.Object object) -> case HM.lookup "value" object of Just (Json.Object object) -> case HM.lookup "value" object of
Just (Json.String date) -> pure date Just (Json.String date) -> pure date
Just _ -> error "ERROR: should be a json String" Just _ -> error "ParseDate ERROR: should be a json String"
Nothing -> error "No date found" Nothing -> error "ParseDate ERROR: no date found"
Just _ -> error "ERROR: should be a json Object" _ -> error "ParseDate ERROR: type error"
Nothing -> pure "No date found"
......
...@@ -38,9 +38,7 @@ type ErrorMessage = String ...@@ -38,9 +38,7 @@ type ErrorMessage = String
-- TODO make instances of Nodes -- TODO make instances of Nodes
-- All the Database is structred like a hierachical Tree -- All the Database is structred like a hierachical Tree
-- Where a is a NodeType: data Tree a = Leaf a | Node' [Tree a]
-- TODO force the logic of the architecture
data Tree a = Empty | Node' a (Tree a) (Tree a) deriving (Show)
data NodeType = NodeUser data NodeType = NodeUser
| Folder | Project | Corpus | Document | Folder | Project | Corpus | Document
......
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