
24 Nov
2020
24 Nov
'20
10:37 p.m.
On Tue, Nov 24, 2020 at 02:26:03PM -0800, Todd Wilson wrote:
This has got to be a trivial question, but I don't see a solution, nor could I find anything through searching: If I want to write a type declaration for the helper function g here, what do I write?
f :: a -> [b] -> [(a,b)] f a bs = g bs where g :: ???? g [] = [] g (x:xs) = (a,x) : g xs
You probably want this: {-# LANGUAGE ScopedTypeVariables #-} f :: forall a b. a -> [b] -> [(a,b)] f a bs = g bs where g :: [b'] -> [(a, b')] g [] = [] g (x:xs) = (a,x) : g xs