Skip to content

Instantly share code, notes, and snippets.

@applePrincess
Created May 14, 2023 02:13
Show Gist options
  • Save applePrincess/886d0580cfcc3b4352f9662cf3a6e129 to your computer and use it in GitHub Desktop.
Save applePrincess/886d0580cfcc3b4352f9662cf3a6e129 to your computer and use it in GitHub Desktop.
Functional Dependencies not working in Idris2?
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1683777345,
"narHash": "sha256-V2p/A4RpEGqEZussOnHYMU6XglxBJGCODdzoyvcwig8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "635a306fc8ede2e34cb3dd0d6d0a5d49362150ed",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
{
description = "A very basic flake";
outputs = { self, nixpkgs }: {
devShells.x86_64-linux.default =
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
in
pkgs.mkShell {
buildInputs = with pkgs; [
idris idris2
];
};
};
}
interface Custom (a : Type) (b : Type) | a where
Custom Nat Nat where
Custom Nat Bool where
f : Custom a b => a -> b -> Unit
f _ _ = ()
g : Unit
g = let x : Nat = 3
in f x x
@applePrincess
Copy link
Author

Running

idris --check --total --nobanner FunDep.idr

outputs

FunDep.idr:4:1-15:
  |
4 | Custom Nat Bool where
  | ~~~~~~~~~~~~~~~
Overlapping implementation: Custom Nat Nat already defined

which is (at least I think) expected behaviour.
However on idris2

idris2 --check --total --no-banner FunDep.idr

outputs

1/1: Building FunDep (FunDep.idr)

Probably expecting behaviour? I don't know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment