In almost every functional language I know of, quantified type variables are identified using case:
-- haskell / almost everything miranda-influenced
repl :: a -> Int -> List a
-- quantified vars are lowercase, concrete types/kinds are uppercase
However, you can do it without case analysis, using explicit quantification:
-- this also happens to be valid haskell assuming -XRankNTypes
repl :: forall a, a -> Int -> List a
You then, however, encounter a bit of an issue when making trait/typeclass instance declarations:
instance Show a => Show (Maybe a) where
...
vs
-- This is not, as far as I know, valid haskell
instance forall a, Show a => Show (Maybe a) where
...
To be perfectly blunt, that syntax isn't amazing. The actual content, ie Show (Maybe a) gets lost in the requirements and quantification.
However, without using case as a syntactic element, i'm not seeing a better way to do it.
Some things i've considered, but am still open to:
using `a, ...` === the conventional `forall a, ...` - more unclear
using symbols (ie the actual forall symbol) - more confusing
I am fully open to a different instance syntax if it helps mitigate this issue.
more info: My language is close enough to this haskell syntax that any modification to said haskell syntax would transfer over reasonably, so feel free to response in haskell/psudohaskell.
'a, i.e. an identifier preceded by a single quote. If I'm understanding the purpose of this syntax in Haskell (a language I don't use). $\endgroup$'asyntax isn't the worst if I don't find a better solution. Thank you both. $\endgroup$