clash-lang / clash-lang/clash-compiler

No blackbox found for: GHC.Integer.Type.gcdInteger

Open
#369 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Haskell
Stars
1.6k
Forks
169
Avg merge
15h 52m
Merged PRs (30d)
46

Description

It is very easy to stumble into this with `realToFrac`:

```haskell
{-# LANGUAGE ScopedTypeVariables #-}

module Hi where

import Clash.Prelude

{-# ANN test
((defSyn "test")
{ t_name = "test"
, t_inputs = [PortName "x"]
, t_output = PortName "out"
})
#-}
test :: Signal System (SFixed 16 16)
-> Signal System (SFixed 18 18)
test = fmap realToFrac
```

Admittedly, `realToFrac` is defined in terms of `toRational . fromRational` so this may be something just Clash just can't reasonably be expected to implement. Afterall, I suspect that `resizeF` would be a better replacement for `realToFrac` in most cases.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the provided Clash example using realToFrac and confirm the missing blackbox error for GHC.Integer.Type.gcdInteger. Compare this behavior with the suggested resizeF alternative and determine whether the expected outcome is a supported blackbox or documented limitation; done means the example no longer fails unexpectedly or the limitation is clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.