OCaml also has the feature he is asking for too.  A complete example with 
inline typing as an example:
```ocaml
type myRecord = {
  someInt : int;
  someStr : string;
  someFlt : float;
  }

let createMyRecord : int -> string -> float -> myRecord =
fun someInt someStr someFlt ->
  { someInt; someStr; someFlt }

let myRecordTest =
  createMyRecord 42 "Hello World" 6.28

let () = Js.log myRecordTest
```
See the function `createMyRecord`.
Which you can see in action at: 
 
https://bloomberg.github.io/bucklescript/js-demo/?gist=350dbcbed9ed226ea005d0ced67ee777



On Saturday, September 24, 2016 at 1:40:38 PM UTC-6, Janis Voigtländer 
wrote:
>
> That feature, for pattern matching, Elm already has.
>
> Am 24.09.2016 um 20:38 schrieb Dave Thomas <[email protected] 
> <javascript:>>:
>
> I don't think its overly verbose as it is, ocaml has a feature called 
> field pruning:
>
> When the name of a variable coincides with the name of a record field, 
>> OCaml provides some handy syntactic shortcuts. For example, the pattern in 
>> the following function binds all of the fields in question to variables of 
>> the same name. 
>
>  
>
> let host_info_to_string { hostname; os_name; cpu_arch; timestamp; _ } =
>      sprintf "%s (%s / %s) <%s>" hostname os_name cpu_arch
>        (Time.to_string timestamp)
>
>
>  
>
> On Saturday, September 24, 2016 at 6:27:07 PM UTC+1, Joey Eremondi wrote:
>>
>> Can you give a concrete example of what this would look like in Elm? Are 
>> you sure this is compatible with type inference?
>>
>> On Sep 24, 2016 10:46 AM, "Zane Hitchcox" <[email protected]> wrote:
>>
>>> Shorthand property names like in javascript 
>>> <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer>
>>>
>>>
>>> These are a great feature, and maybe elm can steal something from 
>>> javascript for a change.
>>>
>>>
>>> Like I see no reason for this overly-verbose syntax:
>>>
>>>
>>> main : Program Nevermain =
>>>     Html.App.program
>>>         { init = init
>>>         , view = view
>>>         , update = update
>>>         , subscriptions = subscriptions
>>>         }
>>>
>>> -- 
>>> 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.
>>>
>> -- 
> 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] <javascript:>.
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to