Skip to content

error involving uverb #1381

@fisx

Description

@fisx

If you copy the following code into Servant.API.UVerb.Union:

data User tag = User

type XS tag = Union '[User tag, ()]

f :: forall tag m. Applicative m => User tag -> m (XS tag)
f usr = either respond respond $ (undefined :: Either () (User tag))

respond ::
  forall (x :: *) (xs :: [*]) (f :: * -> *).
  (Applicative f, IsMember x xs) =>
  x ->
  f (Union xs)
respond = pure . inject . I

you get:

Servant/API/UVerb/Union.hs:159:24: warning: [-Wdeferred-type-errors]
    • Expected one of:
          '[User tag, ()]
      But got:
          User tag
    • In the second argument of ‘either’, namely ‘respond’
      In the expression: either respond respond
      In the expression:
        either respond respond $ (undefined :: Either () (User tag))
    |
159 | f usr = either respond respond $ (undefined :: Either () (User tag))
    |                        ^^^^^^^

Without the phantom tag, it compiles fine. I would have expected it to compile both ways.

Metadata

Metadata

Assignees

Labels

uverbBugs and questions related to UVerb

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions