[Haskell-cafe] Got problems with classes

Grigory Sarnitskiy sargrigory at ya.ru
Mon Aug 17 02:35:33 EDT 2009


Hello! I can't understand why the following dummy example doesn't work.

{-# OPTIONS -XTypeSynonymInstances #-}
{-# OPTIONS -XFlexibleInstances #-} 
module Main where
import Data.Array.Unboxed

class Particle p

type ParticleC  =  (Double, Double, Double)
instance Particle ParticleC

class Configuration c where
    getParticleI :: (Particle p) => c -> Int -> p

type Collection p = UArray (Int,Int) Double
instance Configuration (Collection p) where
    getParticleI config i = (1,1,1) :: ParticleC


More information about the Haskell-Cafe mailing list