I bet that Backpack error messages are way harder to understand
I was curious, so I took this example and introduced some errors to see what they looked like.
Leaving the Str
module signature unfilled here:
mixins:
...
lesson2-signatures (Lesson2 as Lesson2.Text)
The error:
Non-library component has unfilled requirements: Str
In the stanza 'executable lesson2'
In the inplace package 'lesson2-signatures-1.0.0.0'
Giving an implementation type here a kind different to what the module signature specifies:
type Str = Maybe
splitOn :: Char -> Maybe () -> Maybe ()
splitOn c = undefined
The error:
• Type constructor ‘Str’ has conflicting definitions in the module
and its hsig file
Main module: type Str :: * -> *
type Str = GHC.Maybe.Maybe :: * -> *
Hsig file: type Str :: *
data Str
The types have different kinds
• while checking that lesson2-signatures-1.0.0.0:impl-text:Str.Text implements signature Str in lesson2-signatures-1.0.0.0[Str=lesson2-signatures-1.0.0.0:impl-text:Str.Text]
Removing the function splitOn
from the implementation module here so that it can’t correctly instantiate the module signature.
The error:
lib/Str.hsig:1:1: error:
• ‘splitOn’ is exported by the hsig file, but not exported by the implementing module ‘lesson2-signatures-1.0.0.0:impl-text:Str.Text’
• while checking that lesson2-signatures-1.0.0.0:impl-text:Str.Text implements signature Str in lesson2-signatures-1.0.0.0[Str=lesson2-signatures-1.0.0.0:impl-text:Str.Text]
|
1 | signature Str where