On Friday, March 10, 2017 at 3:49:34 AM UTC, Matthieu Pizenberg wrote:
>
> So I think a type becomes opaque if its constructors are not exposed, or 
>> if its module is not exposed.
>> It might be better in that case, if the compiler just referred to the 
>> opaque type as Animation.State?
>>
>  
> Actually, the compiler can do that. I just checked and figured that it was 
> a design choice from mdgriffith. I have made this simple example:
>
> -- module Private exposing (..)
> type Test = SomeTest | OtherTest
>
> -- module Public exposing (Test)
> import Private
> type alias Test = Private.Test
>
> -- module Test exposing (testFunction)
> import Public exposing (Test)
> import Private
> testFunction : Test
> testFunction = Private.SomeTest
>
> In that case, both the documentation and the compiler refers the return 
> type of testFunction to be Public.test.
>
> One way you can create a partially exposed type is like this:
>>
>> module Test exposing (Test(One))
>>
>> type Test
>>     = One
>>     | Two
>>
>
>  Thanks, it wasn't the kind of "partial" exposure I had in mind but good 
> to know in case I have this kind of need some time.
>

What is the difference between your code and this extracted from 
elm-style-animation:

module Animation.Model exposing (..)

type Animation msg
    = Animation
        { steps : List (Step msg)
        , style : List Property
        , timing : Timing
        , running : Bool
        , interruption : List ( Time, List (Step msg) )
        }


module Animation
    exposing
        ( ...
        , State
        , ...
        )
{-| _Note_ - The compiler will refer to your `Animation.State` as 
`Animation.Model.Animation msg`
-}
type alias State =
    Animation.Model.Animation Never


Did calling the type and its alias both 'Test' somehow override the private 
one with the public one?

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to