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

Unexpected errors when extending by the same field twice #16

Open
adamgundry opened this issue Apr 11, 2018 · 0 comments
Open

Unexpected errors when extending by the same field twice #16

adamgundry opened this issue Apr 11, 2018 · 0 comments

Comments

@adamgundry
Copy link

Of course, mkR .* #x .= 'a' .* #x .= 'b' is wrong, but it would be nice if it gave a clear error and didn't defer it unexpectedly.

$ ghci -fplugin=Coxswain -XOverloadedLabels -XDataKinds -XTypeFamilies -XTypeOperators -XFlexibleContexts -fconstraint-solver-iterations=1000
GHCi, version 8.2.1: http://www.haskell.org/ghc/  :? for help
Prelude> :m + Data.Sculls.Symbol
Prelude Data.Sculls.Symbol> mkR .* #x .= 3 .* #x .= 4

<interactive>:1:1: error:
    Ambiguous type variables t0, t1 arising from a use of print
    prevents the constraint (Data.Sculls.Internal.RecordAndVariant.RAll2
                                (ShowCol I)
                                (Normalize ((Row0 .& ("x" .= t0)) .& ("x" .= t1)))
                                2) from being solved.
    Probable fix: use a type annotation to specify what t0, t1 should be.
    These potential instance exist:
      instance forall kl kt (c :: kl
                                  -> kt -> Constraint) (l0 :: kl) (t0 :: kt) (l1 :: kl) (t1 :: kt).
               (c l0 t0, c l1 t1) =>
               Data.Sculls.Internal.RecordAndVariant.RAll2
                 c ('NExt ('NExt 'NRow0 l1 t1) l0 t0) 2
        -- Defined in ‘Data.Sculls.Internal.RecordAndVariant’
Prelude Data.Sculls.Symbol> mkR .* #x .= 'a' .* #x .= 'b' :: R I (Row0 .& "x" .= Char)
{(x=*** Exception: <interactive>:3:1: error:
     No instance for (Lacks (Row0 .& ("x" .= Char)) "x")
        arising from a use of ‘.*’
     In the expression:
          mkR .* #x .= 'a' .* #x .= 'b' :: R I (Row0 .& ("x" .= Char))
      In an equation for it’:
          it = mkR .* #x .= 'a' .* #x .= 'b' :: R I (Row0 .& ("x" .= Char))
(deferred type error)
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