value-restriction Questions
1
I'm encoding a form of van Laarhoven lenses in OCaml, but am having difficulty due to the value restriction.
The relevant code is as follows:
module Optic : sig
type (-'s, +'t, +'a, -'b) t
val le...
Fist asked 21/3, 2015 at 19:49
3
Here’s my thoughts on the question. Can anyone confirm, deny, or elaborate?
I wrote:
Scala doesn’t unify covariant List[A] with a GLB ⊤ assigned to List[Int], bcz afaics in subtyping “biunifica...
Lento asked 3/2, 2018 at 6:50
2
Solved
This code doesn't compile:
let f = fun x y -> x <<< y // bit shift
let g = fun x y -> x <<< y
[<EntryPoint>]
let main _ =
printfn "%d" <| f 1 10
printfn "%d" &l...
Policeman asked 29/10, 2014 at 14:27
3
Solved
I am a little confused about weak polymorphism in OCaml.
Please see the following snippet, where I define a function remember:
let remember x =
let cache = ref None in
match !cache with
| Some...
Outleap asked 29/7, 2013 at 0:27
2
I'm trying to write a function, that takes an integer and a triplet and returns an element of the triplet at the given position (exercise 5.3 from Hickey's book). Triplet should be able to contain ...
Amazement asked 2/10, 2012 at 17:36
1
Solved
I have a F# function:
let removeEven (listToGoUnder : _ list) =
let rec listRec list x =
match list with
| [] -> []
| head::tail when (x%2 = 0) -> head :: listRec (tail) (x+1)
| head::t...
Capstan asked 23/2, 2012 at 12:54
1
Solved
I have read all treads about value restriction in F#, but I still not understand it. I have the following code:
type tree<'a> =
| Nil
| Node of (tree<'a> * 'a * tree<'a>)
let...
Subdivision asked 1/11, 2010 at 19:0
3
Solved
Is it possible to partially apply a function such as bprintf and prevent it from being restricted based on its initial use?
I'd like to do the following:
let builder = new System.Text.StringBuild...
Midden asked 28/10, 2010 at 21:27
3
Solved
I don't understand how the Value Restriction in F# works. I've read the explanation in the wiki as well as the MSDN documentation. What I don't understand is:
Why, for example, this gives me a V...
Rectory asked 15/7, 2009 at 13:37
1
Solved
I've read the blurb at StrangeLights, I've read the passage from Expert F# (page 119), but I can't see how they apply to my code:
For my tests, I want to check equality between floats, with a bit ...
Chemush asked 6/1, 2009 at 13:26
1
© 2022 - 2024 — McMap. All rights reserved.