Re: [elm-discuss] Re: Unit Types : A Radical Proposal

2016-08-04 Thread John Bugner
I just realized that Elm already uses this strategy... with `Color`! It has 
two constructors: RGBA and HSLA ( 
https://github.com/elm-lang/core/blob/master/src/Color.elm ), but neither 
is exported. This forces the user to use the various 'creation' functions 
to create one ( 
http://package.elm-lang.org/packages/elm-lang/core/4.0.4/Color ). There's 
no reason why the same thing couldn't be done with an `Angle` type. All the 
trig functions and angle creation functions in `Basics` should probably be 
moved to a new `Angle` module too then.

On Friday, July 29, 2016 at 11:55:35 AM UTC-5, Duane Johnson wrote:
>
>
> On Fri, Jul 29, 2016 at 10:48 AM, Anton Lorenzen  > wrote:
>
>> I just created a small library for this:
>> https://github.com/anfelor/elm-units
>>
>> It allows for time to be used like this:
>> Units.Time.every (30 ::: milliseconds) Tick
>>
>
>
> Neat! I'm surprised at what can be done with existing syntax and types.
>

-- 
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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: Unit Types : A Radical Proposal

2016-07-29 Thread Duane Johnson
On Fri, Jul 29, 2016 at 10:48 AM, Anton Lorenzen  wrote:

> I just created a small library for this:
> https://github.com/anfelor/elm-units
>
> It allows for time to be used like this:
> Units.Time.every (30 ::: milliseconds) Tick
>


Neat! I'm surprised at what can be done with existing syntax and types.

-- 
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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: Unit Types : A Radical Proposal

2016-07-28 Thread Joey Eremondi
There is also some prior art with Haskell for this:

https://hackage.haskell.org/package/uom-plugin

https://hackage.haskell.org/package/units

https://hackage.haskell.org/package/Measure



On Thu, Jul 28, 2016 at 12:33 PM, Duane Johnson 
wrote:

>
> On Thu, Jul 28, 2016 at 1:11 PM, art yerkes  wrote:
>
>> F# is kind of radical in that it has units.
>>
>> https://fsharpforfunandprofit.com/posts/units-of-measure/
>>
>
> Wow, very neat! I like that F# keeps the units after the number, actually
> adding to readability.
>
> --
> 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 elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [elm-discuss] Re: Unit Types : A Radical Proposal

2016-07-28 Thread Duane Johnson
On Thu, Jul 28, 2016 at 1:11 PM, art yerkes  wrote:

> F# is kind of radical in that it has units.
>
> https://fsharpforfunandprofit.com/posts/units-of-measure/
>

Wow, very neat! I like that F# keeps the units after the number, actually
adding to readability.

-- 
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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.