Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve #40 by removing the TextShow I16 instance #46

Merged
merged 1 commit into from
Mar 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## next [????.??.??]
* Remove the `TextShow I16` instance from `TextShow.Data.Text`. The usefulness
of this instance was dubious at best, and moreover, it was actively causing
issues when building `text-show` with `reflex-platform` (see
[#40](https://github.com/RyanGlScott/text-show/issues/40)).

### 3.7.5 [2018.10.07]
* _Actually_ make `showbEFloat`'s behavior match that of `showEFloat` in
`base-4.12`.
Expand Down
12 changes: 7 additions & 5 deletions src/TextShow/Data/Text.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,20 @@ Maintainer: Ryan Scott
Stability: Provisional
Portability: GHC

'TextShow' instances for 'Text' types.
Defines 'TextShow' instances for 'Text' types, as well as other miscellaneous
data types from the @text@ package.

Note that this module deliberately does not define a 'TextShow' instance for
the @I16@ data type from @Data.Text.Foreign@, as that module is not available
on certain widely used variants of GHC (e.g., @reflex-platform@). See #40
for more details. If this is a problem for you, please file an issue.

/Since: 2/
-}
module TextShow.Data.Text () where

import qualified Data.Text as TS
import Data.Text.Encoding.Error (UnicodeException(..))
import Data.Text.Foreign (I16)
import qualified Data.Text.Lazy as TL
import Data.Text.Lazy.Builder (Builder, fromString, toLazyText)

Expand Down Expand Up @@ -60,9 +65,6 @@ instance TextShow Builder where
showb = showb . toLazyText
{-# INLINE showb #-}

-- | /Since: 2/
$(deriveTextShow ''I16)

-- | /Since: 2/
instance TextShow UnicodeException where
showb (DecodeError desc (Just w))
Expand Down
6 changes: 1 addition & 5 deletions tests/Instances/Data/Text.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Portability: GHC
module Instances.Data.Text () where

import Data.Text.Encoding.Error (UnicodeException(..))
import Data.Text.Foreign (I16)
import Data.Text.Lazy.Builder (Builder, fromString)

#if MIN_VERSION_text(1,0,0)
Expand All @@ -37,15 +36,12 @@ import Instances.Utils.GenericArbitrary (genericArbitrary)
import Prelude ()
import Prelude.Compat

import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum)
import Test.QuickCheck (Arbitrary(..))
import Test.QuickCheck.Instances ()

instance Arbitrary Builder where
arbitrary = fromString <$> arbitrary

instance Arbitrary I16 where
arbitrary = arbitraryBoundedEnum

instance Arbitrary UnicodeException where
arbitrary = genericArbitrary

Expand Down
3 changes: 0 additions & 3 deletions tests/Spec/Data/TextSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import qualified Data.Text as TL
import Data.Text.Encoding (Decoding)
#endif
import Data.Text.Encoding.Error (UnicodeException)
import Data.Text.Foreign (I16)
#if MIN_VERSION_text(1,1,0)
import Data.Text.Internal.Fusion.Size (Size)
#endif
Expand All @@ -43,8 +42,6 @@ spec = parallel $ do
matchesTextShowSpec (Proxy :: Proxy TS.Text)
describe "lazy Text" $
matchesTextShowSpec (Proxy :: Proxy TL.Text)
describe "I16" $
matchesTextShowSpec (Proxy :: Proxy I16)
describe "UnicodeException" $
matchesTextShowSpec (Proxy :: Proxy UnicodeException)
#if MIN_VERSION_text(1,0,0)
Expand Down