Last active
April 16, 2017 21:27
-
-
Save oleks/b89b21aec02e89b52d2c7a93faa25510 to your computer and use it in GitHub Desktop.
Defining equality for a non-dependent type hosting a dependent type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module A | |
import Data.Vect | |
data T | |
= Val Int | |
| Vec (Vect len T) | |
vectEq : Eq a => Vect n a -> Vect m a -> Bool | |
vectEq {n} {m} v w = n == m && Just v == (exactLength n w) | |
Eq T where | |
(==) (Val i) (Val j) = i == j | |
(==) (Vec v) (Vec w) = vectEq v w | |
(==) _ _ = False | |
{- | |
A.idr:13:3: | |
Prelude.Interfaces.A.T implementation of Prelude.Interfaces.Eq, method == | |
is possibly not total due to recursive path Prelude.Interfaces.A.T | |
implementation of Prelude.Interfaces.Eq, method == --> | |
Prelude.Interfaces.A.T implementation of Prelude.Interfaces.Eq, method == | |
./Prelude/Interfaces.idr:30:5: | |
Prelude.Interfaces.A.T implementation of Prelude.Interfaces.Eq, method /= | |
is possibly not total due to: Prelude.Interfaces.A.T implementation of | |
Prelude.Interfaces.Eq, method == | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment