Skip to content

Instantly share code, notes, and snippets.

@sevanspowell
Created October 29, 2018 01:57
Show Gist options
  • Save sevanspowell/964b96215441d3f11359d5ba1f20123d to your computer and use it in GitHub Desktop.
Save sevanspowell/964b96215441d3f11359d5ba1f20123d to your computer and use it in GitHub Desktop.
ScopedTypeVariables unexpected
• Couldn't match type ‘a’ with ‘a1’
‘a’ is a rigid type variable bound by
the type signature for:
mogel :: forall a. Show a => a -> (String, a)
at src/Types.hs:105:1-48
‘a1’ is a rigid type variable bound by
the type signature for:
b :: forall a1. Show a1 => Maybe a1
at src/Types.hs:108:5-39
Expected type: Maybe a1
Actual type: Maybe a
• In the expression: Just a
In an equation for ‘b’: b = Just a
In the expression:
let
b :: forall a. (Show a) => Maybe a
b = Just a
in maybe ("", a) (\ aa -> (show aa, aa)) b
• Relevant bindings include
b :: Maybe a1 (bound at src/Types.hs:109:5)
a :: a (bound at src/Types.hs:106:7)
mogel :: a -> (String, a) (bound at src/Types.hs:106:1)
|
109 | b = Just a
{-# LANGUAGE ScopedTypeVariables #-}
fn :: forall a . (Show a) => a -> (String, a)
fn a =
let
b :: forall a . (Show a) => Maybe a
b = Just a
in maybe ("", a) (\aa -> (show aa, aa)) b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment