我看到这个片段在the devlog of omegagb:什么数据...在Haskell中意味着什么?
data ExecutionAST result where
Return :: result -> ExecutionAST result
Bind :: (ExecutionAST oldres) -> (oldres -> ExecutionAST result) ->
ExecutionAST result
WriteRegister :: M_Register -> Word8 -> ExecutionAST()
ReadRegister :: M_Register -> ExecutionAST Word8
WriteRegister2 :: M_Register2 -> Word16 -> ExecutionAST()
ReadRegister2 :: M_Register2 -> ExecutionAST Word16
WriteMemory :: Word16 -> Word8 -> ExecutionAST()
ReadMemory :: Word16 -> ExecutionAST Word8
什么是data ... where
是什么意思?我认为关键字data
用于定义新类型。
能有人向我解释,为什么这里需要GADT? – wliao
@wliao:添加了解释。 – sdcvvc
我发现你的解释比视频剪辑更好。谢谢。 – wliao