impredicativetypes Questions
1
What is the relationship between polymorphism's rank and (im)predicativity?
Can rank-1 polymorphism be either predicative or impredicative?
Can rank-k polymorphism with k > 1 be either predica...
Melon asked 3/10, 2019 at 0:57
1
Solved
In Haskell I can't write
f :: [forall a. a -> a]
f = [id]
because
• Illegal polymorphic type: forall a. a -> a
GHC doesn't yet support impredicative polymorphism
But I can happily do
f :: ...
Triboluminescence asked 4/6, 2019 at 17:35
1
Solved
A type like Maybe (Lens' a b) doesn't work because Lens' is under the hood a Rank-2 type, that can't be wrapped in a type constructor without the -XImpredicativeTypes extension (which is not really...
Harmonicon asked 7/1, 2017 at 15:7
2
Solved
I was messing around with the runST function. Which has type (forall s. ST s a) -> a and it seems like trying to use it in any way that isn't directly applying without any indirection breaks it ...
Inoculation asked 30/8, 2016 at 6:40
2
Solved
A friend of mine posed a seemingly innocuous Scala language question last week that I didn't have a good answer to: whether there's an easy way to declare a collection of things belonging to some c...
Rumormonger asked 16/3, 2012 at 6:13
2
Solved
This program:
{-# LANGUAGE RankNTypes, ImpredicativeTypes #-}
import qualified Data.Vector.Mutable as MV
import qualified Data.Vector as V
import Control.Monad.ST
import Control.Monad.Primitive
...
Arnica asked 5/9, 2015 at 20:47
1
Solved
I ran in to a puzzling situation with a higher rank type. I figured out how to make it work, but I don't understand the difference between the working and non-working versions.
With these backgrou...
Wan asked 26/3, 2015 at 18:3
1
Solved
I want something like
f :: [forall m. (Mutable v) (PrimState m) r -> m ()] -> v r -> v r -- illegal signature
f gs x = runST $ do
y <- thaw x
foldM_ (\_ g -> g y) undefined gs -- ...
Kauppi asked 14/11, 2013 at 15:56
3
Take the humble identity function in Haskell,
id :: forall a. a -> a
Given that Haskell supposedly supports impredicative polymorphism, it seems reasonable that I should be able to "restrict...
Coranto asked 5/10, 2011 at 7:9
1
OCaml's Hindley-Milner type system does not allow for impredicative polymorphism (à la System-F), except through a somewhat recent extension for record types. The same applies to F#.
It however is...
Caiman asked 28/3, 2013 at 19:1
3
Solved
The GHC user's guide describes the impredicative polymorphism extension with reference to the following example:
f :: Maybe (forall a. [a] -> [a]) -> Maybe ([Int], [Char])
f (Just g) = Just ...
Antung asked 26/12, 2012 at 22:50
2
Solved
I've been inspired by the recent Haskell blog activity1 to try my hand at writing a Forth-like DSL in Haskell. The approach I have taken is simultaneously straightforward and confusing:
{-# LANGUA...
Petticoat asked 18/2, 2012 at 7:50
1
© 2022 - 2024 — McMap. All rights reserved.