Open bburdette opened 6 years ago
module Main exposing (main)
import Platform
type Form model formData
= SimpleForm (model -> formData)
| AdvancedForm (model -> Bool)
initForm : Form model formData -> model -> Maybe formData
initForm formHelper model =
case formHelper of
SimpleForm toForm ->
toForm model
AdvancedForm _ ->
Nothing
type alias Model internalModel formData =
{ internalModel : internalModel
, form : formData
}
processAction : Form internalModel formData -> Model internalModel formData -> Model internalModel formData
processAction formHelper model =
{ model | form = initForm formHelper model.internalModel }
main : Program () () ()
main =
Platform.worker
{ init = \_ -> ( (), Cmd.none )
, update = \_ _ -> ( (), Cmd.none )
, subscriptions = \_ -> Sub.none
}
Another example. The issue is that toForm model
should be Just (toForm model)
.
I'm getting something similar
type Vector a
= Vector (List a)
type Matrix a
= Matrix (List (Vector.Vector a))
multiplyComplexMatrices : Matrix (Vector.Vector (ComplexNumbers.ComplexNumberCartesian number)) -> Matrix (Vector.Vector (ComplexNumbers.ComplexNumberCartesian number)) -> Matrix (Vector.Vector (ComplexNumbers.ComplexNumberCartesian number))
multiplyComplexMatrices matrixOne matrixTwo =
liftA2 Vector.multiplyComplexVectors matrixOne (transpose matrixTwo)
apply : Matrix (a -> b) -> Matrix a -> Matrix b
apply (Matrix fMatrix) (Matrix matrix) =
Matrix <| List.map2 (\fVector xVector -> Vector.apply fVector xVector) fMatrix matrix
liftA2 : (a -> b -> c) -> Matrix a -> Matrix b -> Matrix c
liftA2 f a b =
apply (map f a) b
transpose : Matrix a -> Matrix a
transpose (Matrix matrix) =
matrix
|> List.map (\(Vector.Vector x) -> x)
|> List.Extra.transpose
|> List.map (\x -> Vector.Vector x)
|> Matrix
map : (a -> b) -> Matrix a -> Matrix b
map f (Matrix matrix) =
Matrix <| List.map (Vector.map f) matrix
{-| Vector map
-}
map : (a -> b) -> Vector a -> Vector b
map f (Vector vector) =
Vector <| List.map f vector
ComplexNumber package here
https://package.elm-lang.org/packages/jonathanfishbein1/complex-numbers/latest/ComplexNumbers
Hi! I'm interested in automatic reduction of elm codebases, so one does not have to do it by hand, like you did.
I'm working on elm-reduce, which is something similar to creduce as my bachelor's thesis, and I need as much test-data for it as possible.
I would love to get into contact with you, but two of you don't have emails listed on your profile. Would you mind sending me a mail? (You can find the address in my profile)
Getting the exact same error when using Monocle.Lens. :| It's killing me. I can prepare a simple case if what's above isn't enough.
I had a similar issue where there was a compiler crash with the MVar issue:
$ elm make .\src\Main.elm --output=/dev/null
Compiling ...elm.exe: .\\Data\\Vector\\Generic\\Mutable.hs:703 (modify): index out of bounds (3,3)
CallStack (from HasCallStack):
error, called at .\\Data\\Vector\\Internal\\Check.hs:87:5 in vector-0.12.0.1-GC2xzdMF0QQGz7ZCcRBJRL:Data.Vector.Internal.Check
The issue seemed to be that the Elm compiler couldn't figure out the Elm error in my code and crashed, because fixing the issue also made the compile work.
I tried to make an ellie of it, but I couldn't make up an example that was able to reproduce it. It would be on line 70 of this successfully-compiling ellie, if looking at this gives any sort of hint (as unlikely as it is though, since I couldn't reproduce it outside my codebase), where I had foo2 = getLocations m
while it should have been foo2 = getLocations m.locations
.
I do have a branch saved that reproduces in my 6k line project, if someone on the dev team would like access, please let me know.
I was trying to make some code more generic and ran into this:
So, here's the minimal example that produces the error. Depends on elm-ui v 1.0.0.
Minimal.elm.txt