Skip to content

Instantly share code, notes, and snippets.

@janwirth
Last active March 15, 2020 10:41
Show Gist options
  • Save janwirth/632aa99524e85e65379f9ad9ee47db15 to your computer and use it in GitHub Desktop.
Save janwirth/632aa99524e85e65379f9ad9ee47db15 to your computer and use it in GitHub Desktop.
{
"type": "application",
"source-directories": [
"src"
],
"elm-version": "0.19.1",
"dependencies": {
"direct": {
"FabienHenon/elm-infinite-list-view": "3.1.1",
"NoRedInk/elm-random-pcg-extended": "1.0.0",
"NoRedInk/elm-uuid": "2.0.0",
"elm/browser": "1.0.2",
"elm/core": "1.0.5",
"elm/file": "1.0.5",
"elm/html": "1.0.0",
"elm/http": "2.0.0",
"elm/json": "1.1.3",
"elm/svg": "1.0.1",
"elm/time": "1.0.0",
"elm/url": "1.0.0",
"elm-community/json-extra": "4.2.0",
"elm-community/list-extra": "8.2.3",
"elm-explorations/benchmark": "1.0.1",
"krisajenkins/remotedata": "6.0.1",
"mdgriffith/elm-ui": "1.1.5",
"ohanhi/remotedata-http": "4.0.0",
"proda-ai/elm-dropzone": "1.0.1",
"wernerdegroot/listzipper": "4.0.0"
},
"indirect": {
"BrianHicks/elm-trend": "2.1.3",
"NoRedInk/elm-random-general": "1.0.0",
"Skinney/murmur3": "2.0.8",
"elm/bytes": "1.0.8",
"elm/parser": "1.1.0",
"elm/regex": "1.0.0",
"elm/virtual-dom": "1.0.2",
"mdgriffith/style-elements": "5.0.1",
"rtfeldman/elm-iso8601-date-strings": "1.1.3"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}
❯ elm make src/Benchmark.elm
Compiling ...
Success!
-- ERROR -----------------------------------------------------------------------
I ran into something that bypassed the normal error reporting process! I
extracted whatever information I could from the internal error:
> Error from `Benchmark` should have been reported already.
> CallStack (from HasCallStack):
> error, called at builder/src/Build.hs:1233:29 in main:Build
These errors are usually pretty confusing, so start by asking around on one of
forums listed at https://elm-lang.org/community to see if anyone can get you
unstuck quickly.
-- REQUEST ---------------------------------------------------------------------
If you are feeling up to it, please try to get your code down to the smallest
version that still triggers this message. Ideally in a single Main.elm and
elm.json file.
From there open a NEW issue at https://github.com/elm/compiler/issues with your
reduced example pasted in directly. (Not a link to a repo or gist!) Do not worry
about if someone else saw something similar. More examples is better!
This kind of error is usually tied up in larger architectural choices that are
hard to change, so even when we have a couple good examples, it can take some
time to resolve in a solid way.elm: Error from `Benchmark` should have been reported already.
CallStack (from HasCallStack):
error, called at builder/src/Build.hs:1233:29 in main:Build
import Benchmark.Runner exposing (BenchmarkProgram, program)
import Dict
main : BenchmarkProgram
main =
program suite
import Array
import Benchmark exposing (..)
size = 1000
createfirstList _ = List.range size (size * 2)
createfirstDict _ = createfirstList _ |> List.map2 Tuple.pair |> Dict.fromList
createsecondDict : a -> Dict.Dict Int Int
createsecondDict _ = createfirstList _ |> List.map2 ((++) size |> Tuple.pair) |> Dict.fromList
insertList _ = createfirstList () ++ createfirstList ()
insertDict _ = createfirstDict () |> Dict.union (createsecondDict ())
suite : Benchmark
suite =
let
sampleArray =
Array.initialize 100 identity
in
describe "Array"
[ -- nest as many descriptions as you like
describe "slice"
[ benchmark "create dict" <|
\_ -> create1000Dict
, benchmark "create list" <|
\_ -> create1000List
, benchmark "insert into dict" <|
\_ -> create1000Dict
, benchmark "insert into list" <|
\_ -> create1000List
]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment