You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 13, 2025. It is now read-only.
The quantise example fails because of a type error:
d1 $ s "superchip*8" # n (quantise 1 $ range (-10) (10) $ slow 8 $ cosine)
# release (quantise 5 $ slow 8 $ sine + 0.1)
No instance for (RealFrac Note) arising from a use of ‘quantise’
RealFrac is the type class that holds the round method that is used in quantize. Note is currently not an instance of RealFrac. Perhaps it should be? Especially in light of the comment (Note is Double)
class (Real a, Fractional a) => RealFrac a where
round :: Integral b => a -> b
quantise :: (Functor f, RealFrac b) => b -> f b -> f b
quantise n = fmap ((/n) . (fromIntegral :: RealFrac b => Int -> b) . round . (*n))
one solution is to derive instance RealFrac Note, by extending this declaration
-- | Note is Double, but with a different parser
newtype Note = Note { unNote :: Double }
deriving (Typeable, Data, Generic, Eq, Ord, Enum, Num,
Fractional, Floating, Real)
[copied from https://club.tidalcycles.org/t/quantise-type/3684]
The quantise example fails because of a type error:
RealFrac is the type class that holds the round method that is used in quantize. Note is currently not an instance of RealFrac. Perhaps it should be? Especially in light of the comment (Note is Double)
one solution is to derive
instance RealFrac Note, by extending this declaration