"Invalid view: fromPathPiece & # 8594; Just dyn_abDD" when using options on routes

I am using yesod version 1.4.0 in the cabal sandbox.

I have the following routes file:

/static StaticR Static getStatic /auth AuthR Auth getAuth /favicon.ico FaviconR GET /robots.txt RobotsR GET / HomeR GET POST /config/#String MakeConfigR GET POST 

and the corresponding compliance handler file (correctly imported and all) for implementation.

However, whenever yesod (or when I manually) try to compile, I get the following error

 Foundation.hs:48:1: Illegal view pattern: fromPathPiece -> Just dyn_abDD Use -XViewPatterns to enable view patterns 

I did not modify Foundation.hs in any way.

When I have only a route that does not accept any parameters, for example

 /noparamshere NoParamsR GET 

or something similar in the routes file, everything works fine. What did I do wrong?

+5
source share
1 answer

I think you created your project with the old version of Yesod. Starting with yesod-1.4.0, you need to enable the ViewPatterns extension as indicated in the error message. Add ViewPatterns in default-extensions to your cache file.

+7
source

Source: https://habr.com/ru/post/1204139/


All Articles