Created
June 29, 2018 08:44
-
-
Save khibino/1dc6a36e64aa5737e40b955b35c5715d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
module Position where | |
import GHC.Generics (Generic) | |
import Foreign.Ptr (Ptr ) | |
import Data.Word (Word8) | |
data Position f = | |
Position | |
{ x :: Double | |
, y :: Double | |
, next :: f (Position f) | |
} deriving Generic | |
data TaggedPosition a = | |
TaggedPosition | |
{ t1 :: Word8 | |
, pos :: a | |
} deriving Generic | |
-- TaggedPosition (Ptr (Position Ptr)) -- for C | |
-- TaggedPosition (Maybe (Position Maybe)) -- for Haskell | |
deriving instance Eq (Position Maybe) | |
deriving instance Eq (TaggedPosition (Maybe (Position Maybe))) | |
deriving instance Show (Position Maybe) | |
deriving instance Show (TaggedPosition (Maybe (Position Maybe))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment