[Haskell-cafe] Assembly EDSL in Haskell

2013-04-01 Thread C K Kashyap
Hi Cafe, I am trying to embed x86 assembly in Haskell. I'd like the EDSL to not allow invalid movements into registers - for example, should not allow moving into RIP. I was not able to get it to work. I ended up using DataTypeContexts - which is considered misfeature anyway. I was wondering if I

Re: [Haskell-cafe] Assembly EDSL in Haskell

2013-04-01 Thread Serguey Zefirov
You have fixed the type of list by move RAX RAX. Now it has type Instruction SNDREG SNDREG Make your Instruction a GADT and require that MOV should have appropriate constraints: {-# LANGUAGE DatatypeContexts, GADTs #-} data SREG = RIP data DREG = RBX data SNDREG = RAX data Instruction where

Re: [Haskell-cafe] Assembly EDSL in Haskell

2013-04-01 Thread C K Kashyap
Wow ... thanks Serguey that gets rid of DatatypeContexts as well! Regards, Kashyap On Mon, Apr 1, 2013 at 9:12 PM, Serguey Zefirov sergu...@gmail.com wrote: You have fixed the type of list by move RAX RAX. Now it has type Instruction SNDREG SNDREG Make your Instruction a GADT and