-
-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Labels
bugSomething isn't workingSomething isn't workingtype inferenceRelated to type inferenceRelated to type inference
Milestone
Description
Consider these two modules:
module LocalizedHtml exposing (Html, Language(..), div, text)
import Html
type Language
= Italian
| English
type alias Html a =
Language -> Html.Html a
type alias Attribute a =
Language -> Html.Attribute a
div : List (Attribute msg) -> List (Html msg) -> Html msg
div attributes children language =
Html.div (List.map (\a -> a language) attributes) (List.map (\c -> c language) children)
text : String -> String -> Html msg
text en it language =
Html.text <|
case language of
English ->
en
Italian ->
it
and
module Main exposing (main)
import LocalizedHtml exposing (Html, Language(..), div, text)
main =
div [] [ hello, world ] English
hello : Html msg
hello =
text "Hello" "Ciao"
world =
text "World" "Mondo"
notice how Main
does not import Html
.
Expected Behavior
The type of world
is inferred to be Html msg
.
Current Behavior
The type of world
is inferred to be Language -> Html msg
.
Context
I'm wrapping elm-ui
to add translations.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingtype inferenceRelated to type inferenceRelated to type inference