Yay, it works. Thank you for teaching me this pattern Thomas!

On Tuesday, November 22, 2016 at 12:22:01 PM UTC+1, Thomas Coopman wrote:
>
> If you have a function: compare : Date -> Foo -> Bool
> you can then do: compareWithDate = compare date
> and in your filter use compareWithDate:
>
> compare : Date -> Foo -> Bool
> compare .....
>
> filterFoos : List Foo -> Date -> List Foo
> filterFoos foos date =
>    let
>      compareWithDate = compare date
>    in
>      List.filter compareWithDate foos
>
>
> On Tue, 22 Nov 2016 at 08:26 Tim Bezhashvyly <[email protected] 
> <javascript:>> wrote:
>
>> Sorry, I'm still not sure how to pass a received date or model to 
>> comparison function.
>>
>>
>> On Tuesday, November 22, 2016 at 3:41:07 AM UTC+1, Max Goldstein wrote:
>>>
>>> You can partially apply the comparison function to the current date 
>>> before passing it to List.filter. The trick is that you have to get the 
>>> current date through a command, and either run the filter when the command 
>>> comes back, or keep the current date in the model. 
>>
>> -- 
>> 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