Tuesday, March 8, 2011

wumpus-basic

Copperbox revision 2191.

I've added an in-progress experiment with new Image and Graphic types. The new types avoid the (conceptual) overhead of ContextFuns which made the old types functors (good - lots of predefined operators) but otherwise added complexity to the types.

The main problem with the new types, which I haven't addressed yet, is that within their newtype wrappers they have different arities - this means any classes that operate on them will have very exotic types and two are illustrated below. Maybe I'll switch to parametrized modules instead, but they lack convenience - operators cannot be infix as they are always a record selector projecting on a concrete instance.


class Annotate t s | t -> s where
  annotate  :: t r u -> s u -> t r u
  decorate  :: t r u -> (r u -> s u) -> t r u
   
class IgnoreAns t s | t -> s where
  ignoreAns :: forall (u :: *) (r :: * -> *). t r u -> s u
  replaceAns :: r1 u ->  t r u -> t r1 u

Blog Archive

About Me

My photo
Disambiguating biog as there are a few Stephen Tetley's in the world. I'm neither a cage fighter or yachtsman. I studied Fine Art in the nineties (foundation Bradford 1992, degree Cheltenham 1992 - 95) then Computing part-time at Leeds Met graduating in 2003. I'm the Stephen Tetley on Haskell Cafe and Stackoverflow.