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