Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Messing up parameters order of interfaces implementation #319

Open
berewt opened this issue Apr 24, 2020 · 0 comments
Open

Messing up parameters order of interfaces implementation #319

berewt opened this issue Apr 24, 2020 · 0 comments

Comments

@berewt
Copy link
Contributor

berewt commented Apr 24, 2020

In some cases (can't be more precise about the context unfortunately) the implementation of a typeclass with several parameters doesn't work, the compiler mixes up the parameter order.
It can be resolve by making the parameters explicit in the signatures of the functions of the typeclass, but they have to be declared in a specific order.

Steps to Reproduce

Try to compile this file

public export
interface IxFunctor (f : (lbl : Type) -> (pre : List lbl) -> (post : List lbl) -> Type -> Type)
          where
  map : (a -> b) -> f ty pre post a -> f ty pre post b
public export
interface (IxFunctor f) =>
          IxApplicative (f : (lbl : Type) -> (pre : List lbl) -> (post : List lbl) -> Type -> Type)
          where
  pure  : {st : List lbl} -> a -> f lbl st st a
  (<*>) : f lbl pre inter (a -> b) -> f lbl inter post a -> f lbl pre post b
data Dummy : (lbl : Type) -> (pre, post : List lbl) -> Type -> Type where
  AmIDumb : a -> Dummy b pre post a
IxFunctor Dummy where
  map func (AmIDumb x) = AmIDumb (func x)
IxApplicative Dummy where
  pure x = ?pure_rhs
  (<*>) mf mx = ?app_rhs

Expected Behavior

It should compile.

Observed Behavior

Test.idr:23:1--38:1:While processing right hand side of IxApplicative implementation at Test.idr:23:1--38:1 at Test.idr:23:1--38:1:
When unifying Dummy lbl post a inter and Dummy lbl inter post a
When unifying Dummy lbl st st a and Dummy lbl st a st
Mismatch between:
	st
and
	a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant