Skip to content

Commit 7a5d373

Browse files
authored
remove restore keys (#53)
1 parent 692250f commit 7a5d373

File tree

3 files changed

+40
-2
lines changed

3 files changed

+40
-2
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ jobs:
4848
with:
4949
path: ${{ steps.setup-haskell.outputs.cabal-store }}
5050
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
51-
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
5251
- name: Build
5352
run: cabal new-build
5453
- name: Test

src/Data/Text/Display.hs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,39 @@ where
2626

2727
import Data.Text.Display.Core
2828
import Data.Text.Display.Generic
29+
30+
-- $designChoices
31+
--
32+
-- === A “Lawless Typeclass”
33+
--
34+
-- The 'Display' typeclass does not contain any law. This is a controversial choice for some people,
35+
-- but the truth is that there are not any laws to ask of the consumer that are not already enforced
36+
-- by the type system and the internals of the 'Data.Text.Internal.Text' type.
37+
--
38+
-- === "🚫 You should not try to display functions!"
39+
--
40+
-- Sometimes, when using the library, you may encounter this message:
41+
--
42+
-- > • 🚫 You should not try to display functions!
43+
-- > 💡 Write a 'newtype' wrapper that represents your domain more accurately.
44+
-- > If you are not consciously trying to use `display` on a function,
45+
-- > make sure that you are not missing an argument somewhere.
46+
--
47+
-- The 'display' library does not allow the definition and usage of 'Display' on
48+
-- bare function types (@(a -> b)@).
49+
-- Experience and time have shown that due to partial application being baked in the language,
50+
-- many users encounter a partial application-related error message when a simple missing
51+
-- argument to a function is the root cause.
52+
--
53+
-- There may be legitimate uses of a 'Display' instance on a function type.
54+
-- But these usages are extremely dependent on their domain of application.
55+
-- That is why it is best to wrap them in a newtype that can better
56+
-- express and enforce the domain.
57+
--
58+
-- === "🚫 You should not try to display ByteStrings!"
59+
--
60+
-- An arbitrary ByteStrings cannot be safely converted to text without prior knowledge of its encoding.
61+
--
62+
-- As such, in order to avoid dangerously blind conversions, it is recommended to use a specialised
63+
-- function such as 'Data.Text.Encoding.decodeUtf8'' or 'Data.Text.Encoding.decodeUtf8With' if you wish to turn a UTF8-encoded ByteString
64+
-- to Text.

text-display.cabal

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ library
6161
import: common-extensions
6262
import: common-ghc-options
6363
hs-source-dirs: src
64-
exposed-modules: Data.Text.Display
64+
exposed-modules:
65+
Data.Text.Display
66+
Data.Text.Display.Core
67+
Data.Text.Display.Generic
6568
build-depends:
6669
, base >=4.12 && <5.0
6770
, bytestring >=0.10 && <0.12

0 commit comments

Comments
 (0)