elm-optimize-level-2/testcases/arityexplorer/Suite.elm
2021-07-07 21:57:21 -04:00

33 lines
650 B
Elm

module Suite exposing (suite)
{-| -}
import V8.Benchmark.Runner.Json exposing (..)
type MyType
= Zero
| One Int
| Two String String
{-| This is an interesting case becase the function be being applied both fully, and partially.
-}
weird : (Bool -> MyType -> Bool) -> ( MyType, List MyType ) -> List Bool
weird fn ( top, remaining ) =
fn True top :: List.map (fn False) remaining
alwaysFalse one two =
False
suite : Benchmark
suite =
describe "Arity"
[ benchmark "Passed function being used fully and partially" <|
\_ ->
weird alwaysFalse ( Zero, [ Zero, Zero, Zero ] )
]