spec = describe "Router" $ do
let sampleRoutes = [( Tuple "/" "views/index.yaml" ),
( Tuple "/foo" "views/foo.yaml" ),
( Tuple "/bar" "views/bar.yaml" )]
it "should default to the first of the list" $ do
r <- fst <$> head sampleRoutes
fprint r
上面抛出以下错误:
Error in declaration spec
Cannot unify Data.Maybe.Maybe with Control.Monad.Eff.Eff u4505.
我相信它是因为它期望第二个参数是 type Eff
,但是由于第二个参数Maybe
引入的使用head
最终是 type Maybe
。
it :: forall e a. String -> Eff e a -> Eff (it :: It | e) Unit
问题是,我不知道如何解决这个问题。我不能有一个Maybe
有效的代码块吗?