summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2019-09-02 10:26:15 -0700
committerBen Sima <ben@bsima.me>2019-09-02 10:26:15 -0700
commitb75efdb2c81bc34b138d316e0893de216e68df91 (patch)
tree13d18ef6a3b7a60c6c2e0549d6fbd702dd1ece1f
parentcbce78bba9696db586d06ede4189d6aa3b52aa6f (diff)
[ibb] reorganize types
Move Person and Book to Biz.Ibb.Core. Now, Biz.Ibb.Influencers is just a list of the people we want to seed the database with. Eventually we will delete this file.
-rw-r--r--lore/Biz/Ibb/Core.hs41
-rw-r--r--lore/Biz/Ibb/Influencers.hs33
-rw-r--r--lore/Biz/Ibb/Keep.hs2
3 files changed, 41 insertions, 35 deletions
diff --git a/lore/Biz/Ibb/Core.hs b/lore/Biz/Ibb/Core.hs
index 39f506c..9ffa966 100644
--- a/lore/Biz/Ibb/Core.hs
+++ b/lore/Biz/Ibb/Core.hs
@@ -1,17 +1,54 @@
{-# LANGUAGE OverloadedStrings #-}
-{-# OPTIONS_GHC -Wall #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DeriveDataTypeable #-}
-- | Main app logic
module Biz.Ibb.Core where
import Alpha
-import Biz.Ibb.Influencers
+import Data.Aeson hiding (Success)
+import Data.Data (Data, Typeable)
+import Data.Text (Text)
+import GHC.Generics (Generic)
import Miso
import Miso.String
import Network.RemoteData
import Servant.API
import Servant.Links
+-- * entity data types
+
+data Person = Person
+ { _name :: Text
+ -- ^ Their full name.
+ , _pic :: Text
+ -- ^ A link to their picture.
+ , _twitter :: Text
+ -- ^ Their twitter handle, without the `@` prefix.
+ , _website :: Text
+ -- ^ Their main website, fully formed: `https://example.com`
+ , _books :: [Book]
+ -- ^ A short list of the books they recommend.
+ , _blurb :: Text
+ -- ^ A short "about" section, like you would see on the jacket flap of a book.
+ } deriving (Generic, Show, Eq, Typeable, Data, Ord)
+
+instance FromJSON Person
+instance ToJSON Person
+
+data Book = Book
+ { _title :: Text
+ , _author :: Text
+ , _amznref :: Text
+ -- ^ Amazon REF number, for creating affiliate links.
+ } deriving (Generic, Show, Eq, Typeable, Data, Ord)
+
+instance FromJSON Book
+instance ToJSON Book
+
+-- * app data types
+
type Routes = Home
type Home = View Action
diff --git a/lore/Biz/Ibb/Influencers.hs b/lore/Biz/Ibb/Influencers.hs
index a31eab4..c31e962 100644
--- a/lore/Biz/Ibb/Influencers.hs
+++ b/lore/Biz/Ibb/Influencers.hs
@@ -4,38 +4,7 @@
module Biz.Ibb.Influencers where
-import Data.Aeson
-import Data.Text (Text)
-import Data.Data (Data, Typeable)
-import GHC.Generics (Generic)
-
-data Person = Person
- { _name :: Text
- -- ^ Their full name.
- , _pic :: Text
- -- ^ A link to their picture.
- , _twitter :: Text
- -- ^ Their twitter handle, without the `@` prefix.
- , _website :: Text
- -- ^ Their main website, fully formed: `https://example.com`
- , _books :: [Book]
- -- ^ A short list of the books they recommend.
- , _blurb :: Text
- -- ^ A short "about" section, like you would see on the jacket flap of a book.
- } deriving (Generic, Show, Eq, Typeable, Data, Ord)
-
-instance FromJSON Person
-instance ToJSON Person
-
-data Book = Book
- { _title :: Text
- , _author :: Text
- , _amznref :: Text
- -- ^ Amazon REF number, for creating affiliate links.
- } deriving (Generic, Show, Eq, Typeable, Data, Ord)
-
-instance FromJSON Book
-instance ToJSON Book
+import Biz.Ibb.Core
allPeople :: [Person]
allPeople =
diff --git a/lore/Biz/Ibb/Keep.hs b/lore/Biz/Ibb/Keep.hs
index 348d0ad..533dab8 100644
--- a/lore/Biz/Ibb/Keep.hs
+++ b/lore/Biz/Ibb/Keep.hs
@@ -12,7 +12,7 @@
--
module Biz.Ibb.Keep where
-import Biz.Ibb.Influencers (Person(..), Book(..))
+import Biz.Ibb.Core (Person(..), Book(..))
import Data.SafeCopy
import Data.Data (Data, Typeable)
import Data.Text (Text)