Skip to content

Instantly share code, notes, and snippets.

@khibino
Created June 29, 2018 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khibino/1dc6a36e64aa5737e40b955b35c5715d to your computer and use it in GitHub Desktop.
Save khibino/1dc6a36e64aa5737e40b955b35c5715d to your computer and use it in GitHub Desktop.
{-# 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