[livecode] Re: Vivid: Are these type signatures necessary?

From: Jeffrey Brown <jeffbrown.the_at_gmail.com>
Date: Sat, 7 Jul 2018 21:03:09 -0500

Fantastic! Thanks, Tom!

On Sat, Jul 7, 2018 at 8:55 PM <amindfv_at_gmail.com> wrote:

> Yep! Use:
>
> {-# LANGUAGE ExtendedDefaultRules #-}
>
> I (with lots of invaluable help from the GHC team) actually submitted a
> patch to GHC specifically so you don't have to write out those type
> signatures.
>
> In general it's easiest to just start every nontrivial Vivid file with:
>
> {-# LANGUAGE DataKinds, ExtendedDefaultRules #-}
> import Vivid
>
> Tom
>
>
> El 7 jul 2018, a las 20:13, Jeffrey Brown <jeffbrown.the_at_gmail.com>
> escribió:
>
> In the recent thread titled "Vivid: Brief, triggered sounds
> <https://we.lurk.org/hyperkitty/list/livecode_at_we.lurk.org/thread/ZQBFCHMBFIIM36KB7S77IDAPYJKMBRF2/>,"
> Tom suggests some code. I was able to run it, after adding a lot of type
> signatures. I suspect there's some extension I'm missing that allows GHC to
> infer those type signatures, because they seem to be flexible (as the
> comments below indicate).
>
> Is there in fact such an extension I should be using?
>
> {-# LANGUAGE DataKinds #-}
>
> import Vivid
>
> foo = sd (1 :: I "gate") $ do
> e <- adsrGen
> (0.2::Double) -- Float or Double works
> (0.1::Double) -- Float or Double works
> (0.6::Double) -- Float or Double works
> (0.7::Double) -- Float or Double works
> (Curve_Curve $ -4)
> (gate_ (V::V "gate"))
> s <- e ~* sinOsc (freq_ (500 :: Double)) -- Float or Double works
> out (0::Integer) [s,s] -- Int or Integer works
>
> main = do
> s <- synth foo ()
> wait 1
> free s
>
>
> --
> Jeff Brown | Jeffrey Benjamin Brown
> Website <https://msu.edu/~brown202/> | Facebook
> <https://www.facebook.com/mejeff.younotjeff> | LinkedIn
> <https://www.linkedin.com/in/jeffreybenjaminbrown>(spammy, so I often
> miss messages here) | Github <https://github.com/jeffreybenjaminbrown>
>
>
> _______________________________________________
> Livecode mailing list -- livecode_at_we.lurk.org
> To unsubscribe send an email to livecode-leave_at_we.lurk.org
>
> _______________________________________________
> Livecode mailing list -- livecode_at_we.lurk.org
> To unsubscribe send an email to livecode-leave_at_we.lurk.org
>


-- 
Jeff Brown | Jeffrey Benjamin Brown
Website <https://msu.edu/~brown202/>   |   Facebook
<https://www.facebook.com/mejeff.younotjeff>   |   LinkedIn
<https://www.linkedin.com/in/jeffreybenjaminbrown>(spammy, so I often miss
messages here)   |   Github <https://github.com/jeffreybenjaminbrown>


_______________________________________________
Livecode mailing list -- livecode_at_we.lurk.org
To unsubscribe send an email to livecode-leave_at_we.lurk.org
Received on Sun Jul 08 2018 - 02:03:33 BST

This archive was generated by hypermail 2.4.0 : Sun Aug 20 2023 - 16:02:23 BST