Effect definitions cannot be given directly (but must be defined previously...)
- Dominant language
- F*
- Stars
- 3.1k
- Forks
- 266
- Avg merge
- 21h 1m
- Merged PRs (30d)
- 54
Description
The following code where the definition of the effect combinators are inlined fails badly :
```total reifiable reflectable new_effect_for_free {
STATE_h (s:Type0) : a:Type -> Effect
with repr = (fun (a:Type) -> s -> M (a * s))
; bind = (fun (a:Type) (b:Type) (f:st s a) (g:a -> st s b) ->
fun (s0:s) -> let (x,s) = f s0 in g x s)
; return = (fun (a:Type) (x:a) -> fun s0 -> x, s0)
}
```
```
Error: Computation for [(fun a b f g s0 -> let uu___#2217 : (tuple2 a@4 s) = (f@2 s0@0) in
(match uu___@0 with
| (Mktuple2 #.uu___#2229 #.uu___#2230 x#2223 s#2224) -> ((g@4 x@1) s@0)))] is not total : PURE (a:Type -> b:Type -> f:(st s a@1) -> g:(uu___:a@2 -> Tot (st s b@2)) -> s0:s -> Tot ((fun s a b f g s0 uu___ -> ((fun s a b f g s0 -> (tuple2 b@3 s@5)) s@6 a@5 b@4 f@3 g@2 s0@1)) s a@4 b@3 f@2 g@1 s0@0 (f@2 s0@0))) !
```
Contributor guide
Research direction
Start with the inline effect-combinator definition and reproduce the reported totality error. Investigate why the inlined definition is rejected despite the shown effect operations, and consider the issue resolved when this example is accepted or produces an appropriate diagnostic.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100