purescript-payload icon indicating copy to clipboard operation
purescript-payload copied to clipboard

Routes spec cannot contain route which matches to url with one-character segments

Open katsujukou opened this issue 2 years ago • 0 comments

When I wrote the spec containing the route which matches to url with one-character segments:

import Prelude
import Effect.Aff (Aff)
import Payload.Server (start_)
import Payload.Spec (Spec(..), GET)

main :: Aff Unit
main = do
  void $ start_ spec { a: \_ -> pure "" }
  where
    spec :: Spec
      { a :: GET "/a"
        { response :: String
        }
      }
    spec = Spec

I got no typeclass instance error:

 No type class instance was found for

    Prim.Symbol.Cons t5
                     t6
                     ""


while solving type class constraint

  Payload.Internal.UrlParsing.Match "/a"
                                    t2
                                    t3
                                    ""
                                    "any"
                                    t4

while applying a function start_
  of type Routable t0 (Record (() @Type)) t1 (Record (() @Type)) => Spec @Type t0 -> t1 -> Aff (Either String Server)
  to argument spec
while inferring the type of start_ spec
in value declaration main

where t0 is an unknown type
      t1 is an unknown type
      t4 is an unknown type
      t2 is an unknown type
      t3 is an unknown type
      t5 is an unknown type
      t6 is an unknown type

I tested this code with TryPureScript.

katsujukou avatar Mar 18 '22 03:03 katsujukou