From f4178f047284730ffb476a7089789c8fb8c0f3f8 Mon Sep 17 00:00:00 2001 From: Stephen Diehl Date: Thu, 30 Jun 2016 11:04:51 -0400 Subject: [PATCH] FAQ section. --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index 7d9dc4311..d60f4bfb4 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,35 @@ Stack LTS resolver. | text | 1.2 | 1.3 | | transformers | 0.4 | 0.6 | +FAQs +---- + +1. My ``putStrLn`` and ``putStr`` instances are no longer inferred in the presense +of the ``-XOverloadedStrings`` extension? + +Because the print functions are polymorphic the type of the print functions may +require annotations if the type is not fully specified by inference. To force a +specific type at the call site use either + +```haskell +putText :: MonadIO m => T.Text -> m () +putLText :: MonadIO m => TL.Text -> m () +``` + +2. How do I write manual Show instances if ``show`` isn't provided? + +Generally speaking writing manual instances of Show is a [Haskell antipattern]( +http://www.stephendiehl.com/posts/strings.html) because it produces +law-violating instances of Show. You probably want to use a pretty printer +library for custom printing. + +If backwards compatibility is needed then the base library can be imported +manually. + +```haskell +import GHC.Show (Show(..)) +``` + License -------