diff options
Diffstat (limited to 'src/Model')
-rw-r--r-- | src/Model/Company.hs | 13 | ||||
-rw-r--r-- | src/Model/Date.hs | 30 | ||||
-rw-r--r-- | src/Model/Degree.hs | 18 | ||||
-rw-r--r-- | src/Model/Header.hs | 25 | ||||
-rw-r--r-- | src/Model/Identity.hs | 14 | ||||
-rw-r--r-- | src/Model/Job.hs | 22 | ||||
-rw-r--r-- | src/Model/Project.hs | 18 | ||||
-rw-r--r-- | src/Model/School.hs | 13 | ||||
-rw-r--r-- | src/Model/SkillType.hs | 15 | ||||
-rw-r--r-- | src/Model/Translated.hs | 19 | ||||
-rw-r--r-- | src/Model/Translation/Key.hs | 28 | ||||
-rw-r--r-- | src/Model/Translation/Language.hs | 12 | ||||
-rw-r--r-- | src/Model/Translation/Message.hs | 90 |
13 files changed, 0 insertions, 317 deletions
diff --git a/src/Model/Company.hs b/src/Model/Company.hs deleted file mode 100644 index 3069488..0000000 --- a/src/Model/Company.hs +++ /dev/null @@ -1,13 +0,0 @@ -{-# LANGUAGE DeriveGeneric #-} - -module Model.Company where - -import GHC.Generics -import Data.Yaml - -data Company = Company - { name :: String - , location :: String - } deriving (Show, Read, Eq, Generic) - -instance FromJSON Company diff --git a/src/Model/Date.hs b/src/Model/Date.hs deleted file mode 100644 index 7edb6fb..0000000 --- a/src/Model/Date.hs +++ /dev/null @@ -1,30 +0,0 @@ -{-# LANGUAGE DeriveGeneric #-} - -module Model.Date where - -import GHC.Generics -import Data.Yaml - -data Date = Date - { month :: Int - , year :: Int - } deriving (Show, Read, Eq, Generic) - -yearAndMonthDiff :: Date -> Date -> (Int, Int) -yearAndMonthDiff d1 d2 = - let totalMonths = monthDiff d1 d2 - in (totalMonths `div` 12, totalMonths `mod` 12) - -monthDiff :: Date -> Date -> Int -monthDiff (Date m1 y1) (Date m2 y2) = - if y1 == y2 then - 1 + abs (m1 - m2) - else - let (minM, minY, maxM, maxY) = - if y1 < y2 then - (m1, y1, m2, y2) - else - (m2, y2, m1, y1) - in 12 * (maxY - minY - 1) + (13 - minM) + maxM - -instance FromJSON Date diff --git a/src/Model/Degree.hs b/src/Model/Degree.hs deleted file mode 100644 index 90feacc..0000000 --- a/src/Model/Degree.hs +++ /dev/null @@ -1,18 +0,0 @@ -{-# LANGUAGE DeriveGeneric #-} - -module Model.Degree where - -import GHC.Generics -import Data.Yaml - -import Model.School -import Model.Translated - -data Degree = Degree - { name :: Translated - , school :: School - , year :: Int - , topics :: [Translated] - } deriving (Show, Read, Eq, Generic) - -instance FromJSON Degree diff --git a/src/Model/Header.hs b/src/Model/Header.hs deleted file mode 100644 index 7581fc5..0000000 --- a/src/Model/Header.hs +++ /dev/null @@ -1,25 +0,0 @@ -module Model.Header - ( Header(..) - , allHeaders - , headerLink - , headerKey - ) where - -import Model.Translation.Key (Key) -import qualified Model.Translation.Key as K - -data Header = - Resume - | Projects - deriving (Enum, Bounded, Show, Eq) - -allHeaders :: [Header] -allHeaders = [minBound..] - -headerLink :: Header -> String -headerLink Resume = "/" -headerLink Projects = "/projects" - -headerKey :: Header -> Key -headerKey Resume = K.Resume -headerKey Projects = K.Projects diff --git a/src/Model/Identity.hs b/src/Model/Identity.hs deleted file mode 100644 index fb640fa..0000000 --- a/src/Model/Identity.hs +++ /dev/null @@ -1,14 +0,0 @@ -{-# LANGUAGE DeriveGeneric #-} - -module Model.Identity where - -import Data.Yaml -import GHC.Generics - -data Identity = Identity - { name :: String - , website :: String - , git :: String - } deriving (Show, Read, Eq, Generic) - -instance FromJSON Identity diff --git a/src/Model/Job.hs b/src/Model/Job.hs deleted file mode 100644 index f6865f4..0000000 --- a/src/Model/Job.hs +++ /dev/null @@ -1,22 +0,0 @@ -{-# LANGUAGE DeriveGeneric #-} - -module Model.Job where - -import Data.Yaml -import GHC.Generics - -import Model.Company -import Model.Date -import Model.Translated - -data Job = Job - { name :: Translated - , description :: Translated - , details :: Maybe [Translated] - , technos :: Maybe [String] - , company :: Company - , beginDate :: Date - , endDate :: Maybe Date - } deriving (Show, Read, Eq, Generic) - -instance FromJSON Job diff --git a/src/Model/Project.hs b/src/Model/Project.hs deleted file mode 100644 index 7825e60..0000000 --- a/src/Model/Project.hs +++ /dev/null @@ -1,18 +0,0 @@ -{-# LANGUAGE DeriveGeneric #-} - -module Model.Project where - -import GHC.Generics -import Data.Yaml - -import Model.Translated - -data Project = Project - { name :: String - , technologies :: [String] - , description :: Maybe Translated - , git :: String - , pageLink :: Maybe String - } deriving (Show, Read, Eq, Generic) - -instance FromJSON Project diff --git a/src/Model/School.hs b/src/Model/School.hs deleted file mode 100644 index cb10ed9..0000000 --- a/src/Model/School.hs +++ /dev/null @@ -1,13 +0,0 @@ -{-# LANGUAGE DeriveGeneric #-} - -module Model.School where - -import GHC.Generics -import Data.Yaml - -data School = School - { name :: String - , location :: Maybe String - } deriving (Show, Read, Eq, Generic) - -instance FromJSON School diff --git a/src/Model/SkillType.hs b/src/Model/SkillType.hs deleted file mode 100644 index 3e533b8..0000000 --- a/src/Model/SkillType.hs +++ /dev/null @@ -1,15 +0,0 @@ -{-# LANGUAGE DeriveGeneric #-} - -module Model.SkillType where - -import GHC.Generics -import Data.Yaml - -import Model.Translated - -data SkillType = SkillType - { name :: Translated - , skills :: [Translated] - } deriving (Show, Read, Eq, Generic) - -instance FromJSON SkillType diff --git a/src/Model/Translated.hs b/src/Model/Translated.hs deleted file mode 100644 index b92ae39..0000000 --- a/src/Model/Translated.hs +++ /dev/null @@ -1,19 +0,0 @@ -{-# LANGUAGE DeriveGeneric #-} - -module Model.Translated where - -import GHC.Generics -import Data.Yaml - -import Model.Translation.Language - -data Translated = Translated - { english :: String - , french :: String - } deriving (Show, Read, Eq, Generic) - -instance FromJSON Translated - -getTranslation :: Language -> Translated -> String -getTranslation English translated = english translated -getTranslation French translated = french translated diff --git a/src/Model/Translation/Key.hs b/src/Model/Translation/Key.hs deleted file mode 100644 index 43381fb..0000000 --- a/src/Model/Translation/Key.hs +++ /dev/null @@ -1,28 +0,0 @@ -module Model.Translation.Key - ( Key(..) - ) where - -data Key = - - Home - | Resume - | Projects - | Contact - - | Experience - | EducationalBackground - | Skills - | Interests - - | Since - | From - | To - | And - - | Month Int - | MonthText Int - | YearText Int - - | TryIt - - | PageNotFound diff --git a/src/Model/Translation/Language.hs b/src/Model/Translation/Language.hs deleted file mode 100644 index a8f5eb9..0000000 --- a/src/Model/Translation/Language.hs +++ /dev/null @@ -1,12 +0,0 @@ -module Model.Translation.Language - ( Language(..) - , languages - ) where - -data Language = - English - | French - deriving (Show, Read, Eq, Enum, Bounded) - -languages :: [Language] -languages = [minBound..] diff --git a/src/Model/Translation/Message.hs b/src/Model/Translation/Message.hs deleted file mode 100644 index c9e0fcb..0000000 --- a/src/Model/Translation/Message.hs +++ /dev/null @@ -1,90 +0,0 @@ -module Model.Translation.Message - ( getMessage - ) where - -import Model.Translation.Language -import Model.Translation.Key - -getMessage :: Key -> Language -> String - -getMessage Home English = "home" -getMessage Home French = "accueil" - -getMessage Resume English = "resume" -getMessage Resume French = "curriculum" - -getMessage Projects English = "projects" -getMessage Projects French = "projets" - -getMessage Contact English = "contact" -getMessage Contact French = "contact" - -getMessage Experience English = "experience" -getMessage Experience French = "expérience" - -getMessage EducationalBackground English = "educational background" -getMessage EducationalBackground French = "études" - -getMessage Skills English = "skills" -getMessage Skills French = "compétences" - -getMessage Interests English = "interests" -getMessage Interests French = "intérêts" - -getMessage Since English = "since" -getMessage Since French = "depuis" - -getMessage From English = "from" -getMessage From French = "de" - -getMessage To English = "to" -getMessage To French = "à" - -getMessage And English = "and" -getMessage And French = "et" - -getMessage (Month m) English = - case m of - 1 -> "january" - 2 -> "february" - 3 -> "march" - 4 -> "april" - 5 -> "may" - 6 -> "june" - 7 -> "july" - 8 -> "august" - 9 -> "september" - 10 -> "october" - 11 -> "november" - 12 -> "december" - _ -> "" -getMessage (Month m) French = - case m of - 1 -> "janvier" - 2 -> "février" - 3 -> "mars" - 4 -> "avril" - 5 -> "mai" - 6 -> "juin" - 7 -> "juillet" - 8 -> "août" - 9 -> "septembre" - 10 -> "octoble" - 11 -> "novembre" - 12 -> "décembre" - _ -> "" - -getMessage (MonthText count) English = "month" ++ (plural count) -getMessage (MonthText _) French = "mois" - -getMessage (YearText count) English = "year" ++ (plural count) -getMessage (YearText count) French = "an" ++ (plural count) - -getMessage TryIt English = "Try it!" -getMessage TryIt French = "Voir" - -getMessage PageNotFound English = "Page not found." -getMessage PageNotFound French = "La page que vous recherchez n'est pas disponible." - -plural :: Int -> String -plural count = if count > 1 then "s" else "" |