[darcs-devel] [patch1900] restrict the defaults for fromPrim/fromPrims

Ganesh Sittampalam bugs at darcs.net
Sat Aug 31 08:41:53 UTC 2019


Ganesh Sittampalam <ganesh at earth.li> added the comment:

>> Incidentally I was surprised to discover that we
>> were getting away without type instance PatchId for
>> both V1 and V2 patches, even though fromPrim
>> mentions them in its signature.
> 
> Yes, quite strange. I was wondering about that, but didn't investigate.
> I hope this is not some sort of defaulting.

I think it's because the type checker is happy to leave type family
applications unreduced if it doesn't have a rule for them. For something
like 'PatchId a' this makes sense as it doesn't know what 'a' is yet.
For things like 'PatchId (RepoPatchV1 prim)' it's a bit weird and often
it leaks into error messages that say "Can't unify PatchId (RepoPatchV1
prim) with Int" when really your mistake was just to not define the type
instance. In this case the argument is being ignored so probably it's
just getting unified with a free type variable which always succeeds.

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/patch1900>
__________________________________


More information about the darcs-devel mailing list