“Yesod devel” fails with fromJust in devel.hs

人盡茶涼 提交于 2019-12-13 17:04:33

问题


When I run "yesod devel" it says "devel.hs: Maybe.fromJust: Nothing

yesod init # created a project bbbb
...
cabal install && yesod devel
...
Registering bbbb-0.0.0...
Starting development server...
Starting devel application
devel.hs: Maybe.fromJust: Nothing

And the web server is not listening the port (I cannot open the site in my browser)

Does anyone know how to fix this?

My environment:

  • yesod-0.9.4.1
  • The Glorious Glasgow Haskell Compilation System, version 7.0.3
  • Mac OS X 10.6.8

Here is dist/devel.hs, which "yesod init" created:

{-# LANGUAGE PackageImports #-}
import "bbbb" Application (withDevelAppPort)
import Data.Dynamic (fromDynamic)
import Network.Wai.Handler.Warp
    (runSettings, defaultSettings, settingsPort, settingsHost)
import Data.Maybe (fromJust)
import Control.Concurrent (forkIO)
import System.Directory (doesFileExist, removeFile)
import System.Exit (exitSuccess)
import Control.Concurrent (threadDelay)

main :: IO ()
main = do
  putStrLn "Starting devel application"
  wdap <- (return . fromJust . fromDynamic) withDevelAppPort
  forkIO . wdap $ \(port, app) -> runSettings defaultSettings
    { settingsPort = port
    , settingsHost = "0.0.0.0"
    } app
  loop

loop :: IO ()
loop = do
  threadDelay 100000
  e <- doesFileExist "dist/devel-terminate"
  if e then terminateDevel else loop

terminateDevel :: IO ()
terminateDevel = exitSuccess

I uploaded all files in bbbb directory and Application.hs is https://github.com/suztomo/LanguageStudy/blob/master/Haskell/Yesod/bbbb/Application.hs .


回答1:


A shot in the dark answer: check in your cabal file that you're using yesod-default 0.5.



来源:https://stackoverflow.com/questions/8974146/yesod-devel-fails-with-fromjust-in-devel-hs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!