You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to incorporate elm-verify-examples and so far its going pretty good.
However I do have one example which is having a problem. Here my is my function and its documentation..
{-| The `unfoldr` function is "dual" to `foldr`. `foldr` reduces a list to a summary value, `unfoldr` builds a list from a seed. The function takes a function and a starting element. It applies the function to the element. If the result is `Just (a, b)`, `a` is accumulated and the function is applied to `b`. If the result is `Nothing`, the list accumulated so far is returned. subtractOneUntilZero : Int -> Maybe (Int, Int) subtractOneUntilZero i = if i /= 0 then Just (i, i - 1) else Nothing unfoldr subtractOneUntilZero 5 --> [ 5, 4, 3, 2, 1 ]-}unfoldr: (b->Maybe ( a, b )) ->b->Listaunfoldr f seed =case f seed ofNothing->[]Just( a, b )->
a :: unfoldr f b
When I run elm-verify-example on this function I get this error..
Ct:list-extra Chadtech$ elm-verify-examples
-- PARSE ERROR - /Users/Chadtech/code/list-extra/tests/VerifyExamples/List/Extra/Unfoldr0.elm
Something went wrong while parsing an `if` expression in subtractOneUntilZero's
definition.
15| if i /= 0 then
16| Just (i, i - 1)
17|
18|
19|
20| spec0 : Test.Test
^
I was expecting:
- an `else` branch. An `if` must handle both possibilities.
- an argument, like `name` or `total`
- the end of that `if`. Maybe you forgot some code? Or maybe the body of
`subtractOneUntilZero` needs to be indented?
I can get around this error by just removing the empty line between the if and else..
if i /=0thenJust(i, i -1)elseNothing
The text was updated successfully, but these errors were encountered:
Hi,
I am trying to incorporate
elm-verify-examples
and so far its going pretty good.However I do have one example which is having a problem. Here my is my function and its documentation..
When I run
elm-verify-example
on this function I get this error..I can get around this error by just removing the empty line between the
if
andelse
..The text was updated successfully, but these errors were encountered: