1
1
mirror of https://github.com/qfpl/applied-fp-course.git synced 2024-11-23 03:44:45 +03:00

Removed some unnecessary comments/code

This commit is contained in:
Sean Chalmers 2017-09-06 09:35:33 +10:00
parent b0f95deae9
commit 0dbad01d36
7 changed files with 1 additions and 43 deletions

View File

@ -10,25 +10,17 @@ module FirstApp.Types
, mkCommentText
, getCommentText
, renderContentType
)where
) where
import Data.ByteString (ByteString)
import Data.Text (Text)
-- In Haskell the `newtype` comes with zero runtime cost. It is purely used for
-- type-checking. So when you have a bare 'primitive' value, like an Int,
-- String, or even [a], you can wrap it up in a `newtype` for clarity.
-- The type system will check it for you, and the compiler will eliminate the
-- cost once it has passed.
newtype Topic = Topic Text
deriving Show
newtype CommentText = CommentText Text
deriving Show
-- Having specialised constructor functions for the newtypes allows you to set
-- restrictions for your newtype.
nonEmptyText
:: (Text -> a)
-> Error

View File

@ -5,7 +5,6 @@ module FirstApp.Conf
, Port (getPort)
, HelloMsg (getHelloMsg)
, parseOptions
, mkMessage
) where
import Control.Exception (bracketOnError)
@ -55,15 +54,6 @@ helloFromStr
helloFromStr =
HelloMsg . fromString
mkMessage
:: Conf
-> LBS.ByteString
mkMessage =
mappend "App says: "
. getHelloMsg
. helloMsg
data Conf = Conf
{ port :: Port
, helloMsg :: HelloMsg

View File

@ -88,8 +88,6 @@ fromDbComment
fromDbComment =
error "fromDbComment not yet implemented"
-- Having specialised constructor functions for the newtypes allows you to set
-- restrictions for your newtype.
nonEmptyText
:: (Text -> a)
-> Error

View File

@ -5,7 +5,6 @@ module FirstApp.Conf
, Port (getPort)
, HelloMsg (getHelloMsg)
, parseOptions
, mkMessage
) where
import Control.Exception (bracketOnError)
@ -56,14 +55,6 @@ helloFromStr
helloFromStr =
HelloMsg . fromString
mkMessage
:: Conf
-> LBS.ByteString
mkMessage =
mappend "App says: "
. getHelloMsg
. helloMsg
data Conf = Conf
{ port :: Port
, helloMsg :: HelloMsg

View File

@ -86,8 +86,6 @@ fromDbComment dbc =
<*> (mkCommentText $ dbCommentComment dbc)
<*> (pure $ dbCommentTime dbc)
-- Having specialised constructor functions for the newtypes allows you to set
-- restrictions for your newtype.
nonEmptyText
:: (Text -> a)
-> Error

View File

@ -5,7 +5,6 @@ module FirstApp.Conf
, Port (getPort)
, HelloMsg (getHelloMsg)
, parseOptions
, mkMessage
) where
import Control.Exception (bracketOnError)
@ -55,14 +54,6 @@ helloFromStr
helloFromStr =
HelloMsg . fromString
mkMessage
:: Conf
-> LBS.ByteString
mkMessage =
mappend "App says: "
. getHelloMsg
. helloMsg
data Conf = Conf
{ port :: Port
, helloMsg :: HelloMsg

View File

@ -82,8 +82,6 @@ fromDbComment dbc =
<*> (mkCommentText $ dbCommentComment dbc)
<*> pure (dbCommentTime dbc)
-- Having specialised constructor functions for the newtypes allows you to set
-- restrictions for your newtype.
nonEmptyText
:: (Text -> a)
-> Error