Comments (4)
Comment by gallais
Tuesday Apr 21, 2020 at 20:56 GMT
Isn't the problem under-constrained?
There is no way to infer a
from the type x
ought to have.
from idris2.
Comment by fabianhjr
Tuesday Apr 21, 2020 at 20:59 GMT
I extracted this from some testing I am doing with Bools and Group interfaces,
module Algebra.Group.Commutative
import Builtin
import Algebra.Group.Magma
import Algebra.Group.Semigroup
import Algebra.Group.Monoid
import Algebra.Group.Group
%default total
public export
interface Magma a ⇒ CommutativeMagma a where
proofOfCommutativity : (x, y: a) → x `op` y = y `op` x
public export
interface (CommutativeMagma a, Semigroup a) => CommutativeSemigroup a where
public export
interface (CommutativeMagma a, Monoid a) => CommutativeMonoid a where
public export
interface (CommutativeMagma a, Group a) => CommutativeGroup a where
{-
-- TODO: Uncomment when Idris2!306 gets fixed
(CommutativeMagma a, Semigroup a) => CommutativeSemigroup a where
(CommutativeMagma a, Monoid a) => CommutativeMonoid a where
(CommutativeMagma a, Group a) => CommutativeGroup a where
-}
So the idea is that from:
[BoolSumMagma] Magma Bool where
False `op` False = False
_ `op` _ = True
[BoolSumCommutativeMagma] CommutativeMagma Bool using BoolSumMagma where
proofOfCommutativity False False = Refl
proofOfCommutativity False True = Refl
proofOfCommutativity True False = Refl
proofOfCommutativity True True = Refl
The implementations of CommutativeSemigroup
and CommutativeMonoid
get derived.
Since it was the same error message when reduced to the one on the first message I left it as reduced as possible.
from idris2.
Comment by fabianhjr
Tuesday Apr 21, 2020 at 21:25 GMT
Oh, wait I get what you are refering to now.
module Test
interface Interface1 a where
x : a
interface Interface2 a where
y : a
interface (Interface1 a, Interface2 a) => InterfaceMix a where
op : a -> a -> a
z : a
z = x `op` y
This works and is less hacky
from idris2.
I still believe that the original problem was under-constrained
and thus working as expected.
from idris2.
Related Issues (20)
- Type checker does not terminate when comparing codata types. HOT 2
- Remove `=` sugar for propositional Equality HOT 3
- Failure to eliminate pattern case when matching by type HOT 3
- `unsafePerformIO` can be optimized out HOT 4
- Overly eager auto implicit in GADT ctor field's type results in typechecking failure
- Source file "Main.idr" is not in the source directory when invoking compiler with `--source-dir` HOT 2
- [ regression ] `Uninhabited (LTE 1 0)` will no longer be found HOT 2
- `idris2 --init` doesn't check a name of a package
- Totality checker fails to recognize missing cases on irrelevant parameter in irrelevant function HOT 1
- Regression in #3234, backticked infix operators are printed incorrectly HOT 1
- Postfix functions are parsed as if inside unquote when are right after unquote HOT 1
- Remove 'Closed' state from linear network API
- Type checking issue with Idris2 Load instruction in dependent context HOT 1
- Fedora FC38, FC39 with racket 7.9 — "make bootstrap-racket" freezes on compilation HOT 2
- No Nested ":" allowed? HOT 5
- FFI: segfault for conflicting names in C++
- Doc: "Multiplicities" section roadmap HOT 7
- [ bug ] Buggy `Data.Fin.fromInteger` in the presence of negative integer literals HOT 1
- Type information is lost/changed when inlining a function (and it's not clear why) HOT 5
- Inconsistency in totality checker with different constants values and representations
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from idris2.