Commit 4b9fdd60 authored by William Yao's avatar William Yao

Merge branch 'update-readme-show' into 'master'

Make mention of how arbitrary Show doesn't work

Closes #15

See merge request !20
parents 355dfbc6 ed7c9544
Pipeline #65953274 passed with stages
in 5 minutes and 43 seconds
......@@ -91,6 +91,16 @@ string-interpolate *must* know what concrete type it's producing; it cannot be
used to generate a `IsString a => a`. If you're using string-interpolate from
GHCi, make sure to add type signatures to toplevel usages!
string-interpolate also needs to know what concrete type it's *interpolating*.
For instance, the following code won't work:
```haskell
showIt :: Show a => a -> String
showIt it = [i|The value: #{it}|]
```
You would need to convert `it` to a String using `show` first.
Strings and characters are always interpolated without surrounding quotes.
```haskell
......@@ -100,7 +110,7 @@ Strings and characters are always interpolated without surrounding quotes.
>>> "We went to go c the sea."
```
You can also interpolate arbitrary expressions:
You can interpolate arbitrary expressions:
```haskell
λ> [i|Tomorrow's date is #{addDays 1 $ utctDay now}.|] :: String
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment