是否可以在Yesod中重命名子网站的端点?
例如,我不想使用yesod-auth提供的/ login或/ email/register,而是将它们称为"/ entrar"和"/ cadastrar"(分别是他们的PT-BR对应物).
我设法做到这一点的唯一方法是设置我stack.yaml使用修改后的本地副本yesod-auth,但我想知道是否有更好的方法.
我写了下面这段代码:
it :: Int -> Int
it n
| n < 1 = error "Invalid entry."
| n == 1 = 0
| otherwise = 1 + it (n `quot` 2)
Run Code Online (Sandbox Code Playgroud)
当我将它加载到GHCi中时,会发生一些奇怪的事情.我第一次调用该函数时it,它工作正常并返回预期的结果.但是,下一次,我得到以下崩溃:
?: :t it
it :: Int -> Int
?: it 2
1
?: it 2
<interactive>:4:1:
Couldn't match expected type `a0 -> t0' with actual type `Int'
The function `it' is applied to one argument,
but its type `Int' has none
In the expression: it 2 …Run Code Online (Sandbox Code Playgroud)