[Haskell-cafe] When the unknown is unknown

Alexander Solla ajs at 2piix.com
Wed Jun 23 18:04:18 EDT 2010

On Jun 23, 2010, at 1:50 PM, Martin Drautzburg wrote:

> I said that a rhythm is a series of Moments (or Beats), each  
> expressed as
> fractions of a bar. But each Moment also has volume. So I could  
> model rhythm
> as Pairs of (Moment, Volume). However I certanly do not want to  
> specify both
> the Moments and the Volume, but rather compute one from the other.

How about something like:

type RhythmScheme = [(Maybe Moment, Maybe Volume)]
type Rhythm       = [(Moment, Volume)]

-- The resolution function will then be a function with type:

rhythm_from_scheme :: RhythmScheme -> Rhythm

-- Though you might want something like 
-- rhythm_from_scheme :: RhythmScheme -> IO Rhythm
-- or
-- rhythm_from_scheme :: Seed -> RhythmScheme -> Rhythm
-- so that you can get and use random numbers, for example.

I guess the point of my suggestion is to let pattern matching in  
function definitions deal with unification of constraints.  Beta  
reduction and unification are two sides of a coin.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100623/88833893/attachment.html

More information about the Haskell-Cafe mailing list