Skip to content

Instantly share code, notes, and snippets.

@bitwombat
Created November 6, 2020 04:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitwombat/d87b025c336fd3c5dd25124c088c3029 to your computer and use it in GitHub Desktop.
Save bitwombat/d87b025c336fd3c5dd25124c088c3029 to your computer and use it in GitHub Desktop.
instancesOfFunc> configure (lib)
Configuring instancesOfFunc-0.1.0.0...
instancesOfFunc> build (lib)
Preprocessing library for instancesOfFunc-0.1.0.0..
Building library for instancesOfFunc-0.1.0.0..
[1 of 1] Compiling InstancesOfFunc
/data/info/programming/haskell/haskellbook/exercises/Ch16/src/InstancesOfFunc.hs:28:31: error:
• Couldn't match expected type ‘a’ with actual type ‘b’
‘b’ is a rigid type variable bound by
the type signature for:
fmap :: forall a b. (a -> b) -> Pair a -> Pair b
at src/InstancesOfFunc.hs:28:3-6
‘a’ is a rigid type variable bound by
the type signature for:
fmap :: forall a b. (a -> b) -> Pair a -> Pair b
at src/InstancesOfFunc.hs:28:3-6
• In the second argument of ‘Pair’, namely ‘(f b)’
In the expression: Pair a (f b)
In an equation for ‘fmap’: fmap f (Pair a b) = Pair a (f b)
• Relevant bindings include
b :: a (bound at src/InstancesOfFunc.hs:28:18)
a :: a (bound at src/InstancesOfFunc.hs:28:16)
f :: a -> b (bound at src/InstancesOfFunc.hs:28:8)
fmap :: (a -> b) -> Pair a -> Pair b
(bound at src/InstancesOfFunc.hs:28:3)
|
28 | fmap f (Pair a b) = Pair a (f b)
| ^^^
/data/info/programming/haskell/haskellbook/exercises/Ch16/src/InstancesOfFunc.hs:31:15: error:
• Couldn't match type ‘a0 -> Pair a0’ with ‘Pair a’
Expected type: Gen (Pair a)
Actual type: Gen (a0 -> Pair a0)
• In the expression: Pair <$> arbitrary
In an equation for ‘arbitrary’: arbitrary = Pair <$> arbitrary
In the instance declaration for ‘Arbitrary (Pair a)’
• Relevant bindings include
arbitrary :: Gen (Pair a) (bound at src/InstancesOfFunc.hs:31:3)
|
31 | arbitrary = Pair <$> arbitrary
| ^^^^^^^^^^^^^^^^^^
-- While building package instancesOfFunc-0.1.0.0 (scroll up to its section to see the error) using:
/home/gbell2/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_3.0.1.0_ghc-8.8.4 --builddir=.stack-work/dist/x86_64-linux/Cabal-3.0.1.0 build lib:instancesOfFunc --ghc-options ""
Process exited with code: ExitFailure 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment