mirror of
https://github.com/qfpl/applied-fp-course.git
synced 2024-11-25 19:24:08 +03:00
Fix up Cabal file setting for exe.
Some of the cabal files had settings that made it difficult/impossible to initiate the project specific repl. This fix allows you to use: ``` $ cabal repl level0<N> ``` To start a repl for the library for that level. Reworded the text for the ``Error`` type on level02 as it wasn't immediately clear that you needed to add your own constructors. Removed the default constructor for (``RqType``, ``Error``, ``ContentType``) to try to make it more obvious that you have things to do there. Turned off the 'dodgy-imports' warning for that file specifically to allow for happy repl'ing.
This commit is contained in:
parent
15e8022c0f
commit
f6d4475913
@ -67,7 +67,7 @@ library
|
||||
-- Base language which the package is written in.
|
||||
default-language: Haskell2010
|
||||
|
||||
executable level01
|
||||
executable level01-exe
|
||||
-- .hs or .lhs file containing the Main module.
|
||||
main-is: Main.hs
|
||||
|
||||
|
@ -72,7 +72,7 @@ library
|
||||
default-language: Haskell2010
|
||||
|
||||
|
||||
executable level02
|
||||
executable level02-exe
|
||||
-- .hs or .lhs file containing the Main module.
|
||||
main-is: Main.hs
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# OPTIONS_GHC -fno-warn-dodgy-exports #-}
|
||||
module FirstApp.Types
|
||||
( Topic
|
||||
, CommentText
|
||||
@ -23,24 +24,23 @@ import Data.Text (Text)
|
||||
-- - View a topic and its comments
|
||||
-- - List the current topics
|
||||
|
||||
-- To that end, we will create the following constructors for our RqType:
|
||||
-- To that end, create the following constructors for our RqType:
|
||||
|
||||
-- AddRq : Which needs the target topic, and the body of the comment.
|
||||
-- ViewRq : Which needs the topic being requested.
|
||||
-- ListRq : Which doesn't need anything and lists all of the current topics.
|
||||
data RqType = RqType
|
||||
data RqType
|
||||
|
||||
-- Not everything goes according to plan, but it's important that our types
|
||||
-- reflect when errors can be introduced into our program. Additionally it's
|
||||
-- useful to be able to be descriptive about what went wrong.
|
||||
|
||||
-- Leave this type empty for now, and we'll fill in the error constructors we
|
||||
-- need as we progress through the application.
|
||||
data Error = Error
|
||||
-- Fill in the error constructors as you need them.
|
||||
data Error
|
||||
|
||||
-- Provide a type to list our response content types so we don't try to do the
|
||||
-- wrong thing with what we meant to be used as text or JSON etc.
|
||||
data ContentType = ContentType
|
||||
-- Provide the constructors for a sum type to specify the `ContentType` Header,
|
||||
-- to be used when we build our Response type.
|
||||
data ContentType
|
||||
|
||||
-- The ``ContentType`` constructors don't match what is required for the header
|
||||
-- information, so write a function that will take our ``ContentType`` and
|
||||
|
@ -74,7 +74,7 @@ library
|
||||
-- Base language which the package is written in.
|
||||
default-language: Haskell2010
|
||||
|
||||
executable level03
|
||||
executable level03-exe
|
||||
-- .hs or .lhs file containing the Main module.
|
||||
main-is: Main.hs
|
||||
|
||||
|
@ -75,7 +75,7 @@ library
|
||||
-- Base language which the package is written in.
|
||||
default-language: Haskell2010
|
||||
|
||||
executable level04
|
||||
executable level04-exe
|
||||
-- .hs or .lhs file containing the Main module.
|
||||
main-is: Main.hs
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user