haskell / haskell/primitive

Ptr operations have the wrong types

Open
#333 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
123
Forks
60
PR merge metrics
No merged PRs in 30d

Description

For example,

```haskell
copyPtrToMutablePrimArray
:: forall m a. (PrimMonad m, Prim a)
=> MutablePrimArray (PrimState m) a
-> Int
-> Ptr a
-> Int
-> m ()
```

This accepts an arbitrary `PrimState m`, but that breaks referential transparency in `ST`, since the result of the `ST` calculation will depend on what's stored at that address at that time. All operations that dereference `Ptr` or `Addr` values should require `PrimState m ~ RealWorld`.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the copyPtrToMutablePrimArray signature shown in the issue, then locate the other operations that dereference Ptr or Addr values. Check how their PrimState constraints are declared; done means all such operations require PrimState m ~ RealWorld without weakening unrelated operations.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.