Commit f051b216 authored by chak@cse.unsw.edu.au.'s avatar chak@cse.unsw.edu.au.

T2688

parent 4bf46ecb
{-# OPTIONS_GHC -XFunctionalDependencies -XMultiParamTypeClasses #-}
module T2688 where
class VectorSpace v s | v -> s where
(*^) :: s -> v -> v
(^/) :: v -> s -> v
v ^/ s = v *^ (1/s)
T2688.hs:1:0:
Couldn't match expected type `s' against inferred type `v'
`s' is a rigid type variable bound by
the class declaration for `VectorSpace' at T2688.hs:5:20
`v' is a rigid type variable bound by
the class declaration for `VectorSpace' at T2688.hs:5:18
When using functional dependencies to combine
VectorSpace v v, arising from a use of `*^' at T2688.hs:8:13-22
VectorSpace v s,
arising from the class declaration for `VectorSpace'
at T2688.hs:(5,0)-(8,22)
T2688.hs:8:13:
Could not deduce (VectorSpace v v)
from the context (VectorSpace v s)
arising from a use of `*^' at T2688.hs:8:13-22
Possible fix:
add (VectorSpace v v) to the context of
the class declaration for `VectorSpace'
In the expression: v *^ (1 / s)
In the definition of `^/': v ^/ s = v *^ (1 / s)
T2688.hs:8:13:
Couldn't match expected type `v' against inferred type `s'
`v' is a rigid type variable bound by
the class declaration for `VectorSpace' at T2688.hs:5:18
`s' is a rigid type variable bound by
the class declaration for `VectorSpace' at T2688.hs:5:20
In the expression: v *^ (1 / s)
In the definition of `^/': v ^/ s = v *^ (1 / s)
T2688.hs:8:19:
Could not deduce (Fractional v) from the context (VectorSpace v s)
arising from a use of `/' at T2688.hs:8:19-21
Possible fix:
add (Fractional v) to the context of
the class declaration for `VectorSpace'
In the second argument of `(*^)', namely `(1 / s)'
In the expression: v *^ (1 / s)
In the definition of `^/': v ^/ s = v *^ (1 / s)
......@@ -198,3 +198,4 @@ test('T2126', normal, compile_fail, [''])
test('T2307', normal, compile_fail, [''])
test('T2414', normal, compile_fail, [''])
test('T2538', normal, compile_fail, [''])
test('T2688', normal, compile_fail, [''])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment