You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I admit I don’t really understand what is failing here so let me start with an example:
Dependency package
-- Copyright (c) 2018-2020, Digital Asset (Switzerland) GmbH and/or its affiliates.
-- All rights reserved.
{-# LANGUAGE UndecidableInstances #-}
module Overlap where
class C a where
unit : a -> ()
instance C () where
unit _ = ()
type Syn r a = (C a, DA.Internal.Record.HasField "i" r a)
class D a where
f : a -> ()
instance Syn r a => D r where
f _ = ()
Main package which depends on the one above via a data-dependency
module Main where
import Overlap
data T = T with
i : ()
x : ()
x = f (T ())
This fails in the LF typechecker (the Daml typechecker is happy)
File: daml/Main.daml
Hidden: no
Range: 1:1-2:1
Source: DAML-LF typechecker
Severity: DsError
Message:
error type checking value Main.x:
type mismatch:
* expected type:
<s_1 : <m_unit : Unit -> Unit -> Unit>;
s_2 :
<m_getField : Unit -> Main:T -> Unit;
m_setField : Unit -> Unit -> Main:T -> Main:T>>
* found type:
<m_unit : Unit -> Unit -> Unit>
* expression:
676e9493c4ffe6ba1ed4e4e1a58c7e8b237a44cdb6ef2c23d9ccbf4c0994627a:Overlap:$fC()
You can see that the s_1 superclass constraint got inlined while s_2 is missing.
Looking at the generated stub code we have
instance (forall r a.
((Overlap.C a),
(Pkg_83623d7b8279455f5257281ab8ec1f9a2c46c61ba44e04db94d69f98c2b74fbf.DA.Internal.Record.HasField "i" r a)) =>
Overlap.D r) where
f _
= (CurrentSdk.GHC.Err.error
(CurrentSdk.Data.String.fromString "data-dependency stub"))
What seems to be happening is that the constraint synonym gets inlined and we turn the instance for the tuple into two separate instances and then we try to typecheck the first instance against the tuple for the constraint synonym.
The text was updated successfully, but these errors were encountered:
I admit I don’t really understand what is failing here so let me start with an example:
Dependency package
Main package which depends on the one above via a data-dependency
This fails in the LF typechecker (the Daml typechecker is happy)
You can see that the
s_1
superclass constraint got inlined whiles_2
is missing.Looking at the generated stub code we have
What seems to be happening is that the constraint synonym gets inlined and we turn the instance for the tuple into two separate instances and then we try to typecheck the first instance against the tuple for the constraint synonym.
The text was updated successfully, but these errors were encountered: