brandonchinn178 / brandonchinn178/ghc-string-interpolation-prototypes

ambiguous type using implicit-builder

Open
#3 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
20
Forks
2
PR merge metrics
No merged PRs in 30d

Description

I am trying to convert

``` haskell
unsafeUnlock :: Show r => Locker r p -> p
unsafeUnlock (Locker rs x) = D.traceShow ("Unsafe UNLOCK requiring " <> show rs) x
```

but a straight forward
``` haskell
unsafeUnlock (Locker rs x) = D.traceShow s"Unsafe UNLOCK requiring ${show rs}" x
```

does not work. Indeed `traceShow` accepts anything showable and doesn't know that `s"..."` is a String.

I have to do force the type with
``` haskell
unsafeUnlock (Locker rs x) = D.traceShow (s"Unsafe UNLOCK requiring ${show rs}" :: String) x
```
which is not ideal. I would expect the expanded code to add the `:: String` but I understand this would not work with `OverloadedStrings`, unless we got `s` for `String`, `t` for `Text` etc ... (or `s@String`).

Contributor guide

No contributing guide indexed for this repository

Research direction

No file or test is named; start by locating the implicit-builder expansion and reproducing the Locker/traceShow example. Done means the interpolation behavior resolves the ambiguous result type without requiring an explicit :: String annotation, with the OverloadedStrings trade-off addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.