Add Generic typeclass to BackendInput and Backend
This commit is contained in:
parent
50f0859e13
commit
3af8426567
@ -1,4 +1,5 @@
|
|||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
{-# LANGUAGE DeriveGeneric #-}
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
module Scaffolding.Scaffolder (scaffold, backendOptions) where
|
module Scaffolding.Scaffolder (scaffold, backendOptions) where
|
||||||
|
|
||||||
@ -8,6 +9,7 @@ import Data.Conduit (yield, ($$), ($$+-))
|
|||||||
import Control.Monad.Trans.Resource (runResourceT)
|
import Control.Monad.Trans.Resource (runResourceT)
|
||||||
import Control.DeepSeq (($!!), NFData)
|
import Control.DeepSeq (($!!), NFData)
|
||||||
import Data.FileEmbed (embedFile)
|
import Data.FileEmbed (embedFile)
|
||||||
|
import GHC.Generics (Generic)
|
||||||
import Data.String (fromString)
|
import Data.String (fromString)
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import qualified Data.Text.Lazy as LT
|
import qualified Data.Text.Lazy as LT
|
||||||
@ -34,6 +36,7 @@ prompt f = do
|
|||||||
data BackendInput = BIUrl
|
data BackendInput = BIUrl
|
||||||
| BIBackend Backend
|
| BIBackend Backend
|
||||||
| BIUndefined
|
| BIUndefined
|
||||||
|
deriving (Generic)
|
||||||
|
|
||||||
instance NFData BackendInput
|
instance NFData BackendInput
|
||||||
|
|
||||||
@ -44,7 +47,9 @@ data Backend = Sqlite
|
|||||||
| MongoDB
|
| MongoDB
|
||||||
| Simple
|
| Simple
|
||||||
| Minimal
|
| Minimal
|
||||||
deriving (Eq, Read, Show, Enum, Bounded)
|
deriving (Eq, Read, Show, Enum, Bounded, Generic)
|
||||||
|
|
||||||
|
instance NFData Backend
|
||||||
|
|
||||||
puts :: LT.Text -> IO ()
|
puts :: LT.Text -> IO ()
|
||||||
puts s = TLIO.putStr (LT.init s) >> hFlush stdout
|
puts s = TLIO.putStr (LT.init s) >> hFlush stdout
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user