{-# LINE 1 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
{-# LANGUAGE CPP, EmptyDataDecls, ExistentialQuantification #-}
module Graphics.UI.FLTK.LowLevel.Fl_Types where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.Ptr as C2HSImp
import Foreign
import Foreign.C hiding (CClock)
import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
import qualified Foreign.ForeignPtr.Unsafe as Unsafe
import Debug.Trace
import Control.Exception
import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum)
import qualified Data.Text as T
import GHC.Stack
import qualified Data.ByteString as B
data SliderType = VertSliderType
| HorSliderType
| VertFillSliderType
| HorFillSliderType
| VertNiceSliderType
| HorNiceSliderType
deriving (Show,Eq)
instance Enum SliderType where
succ VertSliderType = HorSliderType
succ HorSliderType = VertFillSliderType
succ VertFillSliderType = HorFillSliderType
succ HorFillSliderType = VertNiceSliderType
succ VertNiceSliderType = HorNiceSliderType
succ HorNiceSliderType = error "SliderType.succ: HorNiceSliderType has no successor"
pred HorSliderType = VertSliderType
pred VertFillSliderType = HorSliderType
pred HorFillSliderType = VertFillSliderType
pred VertNiceSliderType = HorFillSliderType
pred HorNiceSliderType = VertNiceSliderType
pred VertSliderType = error "SliderType.pred: VertSliderType has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from HorNiceSliderType
fromEnum VertSliderType = 0
fromEnum HorSliderType = 1
fromEnum VertFillSliderType = 2
fromEnum HorFillSliderType = 3
fromEnum VertNiceSliderType = 4
fromEnum HorNiceSliderType = 5
toEnum 0 = VertSliderType
toEnum 1 = HorSliderType
toEnum 2 = VertFillSliderType
toEnum 3 = HorFillSliderType
toEnum 4 = VertNiceSliderType
toEnum 5 = HorNiceSliderType
toEnum unmatched = error ("SliderType.toEnum: Cannot match " ++ show unmatched)
{-# LINE 211 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data ScrollbarType = VertScrollbar
| HorScrollbar
deriving (Show,Eq)
instance Enum ScrollbarType where
succ VertScrollbar = HorScrollbar
succ HorScrollbar = error "ScrollbarType.succ: HorScrollbar has no successor"
pred HorScrollbar = VertScrollbar
pred VertScrollbar = error "ScrollbarType.pred: VertScrollbar has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from HorScrollbar
fromEnum VertScrollbar = 0
fromEnum HorScrollbar = 1
toEnum 0 = VertScrollbar
toEnum 1 = HorScrollbar
toEnum unmatched = error ("ScrollbarType.toEnum: Cannot match " ++ show unmatched)
{-# LINE 212 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data BrowserType = NormalBrowserType
| SelectBrowserType
| HoldBrowserType
| MultiBrowserType
deriving (Show,Eq)
instance Enum BrowserType where
succ NormalBrowserType = SelectBrowserType
succ SelectBrowserType = HoldBrowserType
succ HoldBrowserType = MultiBrowserType
succ MultiBrowserType = error "BrowserType.succ: MultiBrowserType has no successor"
pred SelectBrowserType = NormalBrowserType
pred HoldBrowserType = SelectBrowserType
pred MultiBrowserType = HoldBrowserType
pred NormalBrowserType = error "BrowserType.pred: NormalBrowserType has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from MultiBrowserType
fromEnum NormalBrowserType = 0
fromEnum SelectBrowserType = 1
fromEnum HoldBrowserType = 2
fromEnum MultiBrowserType = 3
toEnum 0 = NormalBrowserType
toEnum 1 = SelectBrowserType
toEnum 2 = HoldBrowserType
toEnum 3 = MultiBrowserType
toEnum unmatched = error ("BrowserType.toEnum: Cannot match " ++ show unmatched)
{-# LINE 213 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data SortType = SortAscending
| SortDescending
deriving (Show,Eq)
instance Enum SortType where
succ SortAscending = SortDescending
succ SortDescending = error "SortType.succ: SortDescending has no successor"
pred SortDescending = SortAscending
pred SortAscending = error "SortType.pred: SortAscending has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from SortDescending
fromEnum SortAscending = 0
fromEnum SortDescending = 1
toEnum 0 = SortAscending
toEnum 1 = SortDescending
toEnum unmatched = error ("SortType.toEnum: Cannot match " ++ show unmatched)
{-# LINE 214 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data FileBrowserType = FileBrowserFiles
| FileBrowserDirectories
deriving (Show,Eq)
instance Enum FileBrowserType where
succ FileBrowserFiles = FileBrowserDirectories
succ FileBrowserDirectories = error "FileBrowserType.succ: FileBrowserDirectories has no successor"
pred FileBrowserDirectories = FileBrowserFiles
pred FileBrowserFiles = error "FileBrowserType.pred: FileBrowserFiles has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from FileBrowserDirectories
fromEnum FileBrowserFiles = 0
fromEnum FileBrowserDirectories = 1
toEnum 0 = FileBrowserFiles
toEnum 1 = FileBrowserDirectories
toEnum unmatched = error ("FileBrowserType.toEnum: Cannot match " ++ show unmatched)
{-# LINE 215 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data FileIconType = FileIconAny
| FileIconPlain
| FileIconFifo
| FileIconDevice
| FileIconLink
| FileIconDirectory
deriving (Show,Eq)
instance Enum FileIconType where
succ FileIconAny = FileIconPlain
succ FileIconPlain = FileIconFifo
succ FileIconFifo = FileIconDevice
succ FileIconDevice = FileIconLink
succ FileIconLink = FileIconDirectory
succ FileIconDirectory = error "FileIconType.succ: FileIconDirectory has no successor"
pred FileIconPlain = FileIconAny
pred FileIconFifo = FileIconPlain
pred FileIconDevice = FileIconFifo
pred FileIconLink = FileIconDevice
pred FileIconDirectory = FileIconLink
pred FileIconAny = error "FileIconType.pred: FileIconAny has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from FileIconDirectory
fromEnum FileIconAny = 0
fromEnum FileIconPlain = 1
fromEnum FileIconFifo = 2
fromEnum FileIconDevice = 3
fromEnum FileIconLink = 4
fromEnum FileIconDirectory = 5
toEnum 0 = FileIconAny
toEnum 1 = FileIconPlain
toEnum 2 = FileIconFifo
toEnum 3 = FileIconDevice
toEnum 4 = FileIconLink
toEnum 5 = FileIconDirectory
toEnum unmatched = error ("FileIconType.toEnum: Cannot match " ++ show unmatched)
{-# LINE 216 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data FileIconProps = FileIconEnd
| FileIconColor
| FileIconLine
| FileIconClosedline
| FileIconPolygon
| FileIconOutlinepolygon
| FileIconVertex
deriving (Show,Eq)
instance Enum FileIconProps where
succ FileIconEnd = FileIconColor
succ FileIconColor = FileIconLine
succ FileIconLine = FileIconClosedline
succ FileIconClosedline = FileIconPolygon
succ FileIconPolygon = FileIconOutlinepolygon
succ FileIconOutlinepolygon = FileIconVertex
succ FileIconVertex = error "FileIconProps.succ: FileIconVertex has no successor"
pred FileIconColor = FileIconEnd
pred FileIconLine = FileIconColor
pred FileIconClosedline = FileIconLine
pred FileIconPolygon = FileIconClosedline
pred FileIconOutlinepolygon = FileIconPolygon
pred FileIconVertex = FileIconOutlinepolygon
pred FileIconEnd = error "FileIconProps.pred: FileIconEnd has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from FileIconVertex
fromEnum FileIconEnd = 0
fromEnum FileIconColor = 1
fromEnum FileIconLine = 2
fromEnum FileIconClosedline = 3
fromEnum FileIconPolygon = 4
fromEnum FileIconOutlinepolygon = 5
fromEnum FileIconVertex = 6
toEnum 0 = FileIconEnd
toEnum 1 = FileIconColor
toEnum 2 = FileIconLine
toEnum 3 = FileIconClosedline
toEnum 4 = FileIconPolygon
toEnum 5 = FileIconOutlinepolygon
toEnum 6 = FileIconVertex
toEnum unmatched = error ("FileIconProps.toEnum: Cannot match " ++ show unmatched)
{-# LINE 217 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data FileChooserType = FileChooserSingle
| FileChooserMulti
| FileChooserCreate
| FileChooserDirectory
deriving (Show,Eq)
instance Enum FileChooserType where
succ FileChooserSingle = FileChooserMulti
succ FileChooserMulti = FileChooserCreate
succ FileChooserCreate = FileChooserDirectory
succ FileChooserDirectory = error "FileChooserType.succ: FileChooserDirectory has no successor"
pred FileChooserMulti = FileChooserSingle
pred FileChooserCreate = FileChooserMulti
pred FileChooserDirectory = FileChooserCreate
pred FileChooserSingle = error "FileChooserType.pred: FileChooserSingle has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from FileChooserDirectory
fromEnum FileChooserSingle = 0
fromEnum FileChooserMulti = 1
fromEnum FileChooserCreate = 2
fromEnum FileChooserDirectory = 4
toEnum 0 = FileChooserSingle
toEnum 1 = FileChooserMulti
toEnum 2 = FileChooserCreate
toEnum 4 = FileChooserDirectory
toEnum unmatched = error ("FileChooserType.toEnum: Cannot match " ++ show unmatched)
{-# LINE 218 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data ButtonType = NormalButtonType
| ToggleButtonType
| HiddenButtonType
| RadioButtonType
deriving (Show,Eq)
instance Enum ButtonType where
succ NormalButtonType = ToggleButtonType
succ ToggleButtonType = HiddenButtonType
succ HiddenButtonType = RadioButtonType
succ RadioButtonType = error "ButtonType.succ: RadioButtonType has no successor"
pred ToggleButtonType = NormalButtonType
pred HiddenButtonType = ToggleButtonType
pred RadioButtonType = HiddenButtonType
pred NormalButtonType = error "ButtonType.pred: NormalButtonType has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from RadioButtonType
fromEnum NormalButtonType = 0
fromEnum ToggleButtonType = 1
fromEnum HiddenButtonType = 3
fromEnum RadioButtonType = 102
toEnum 0 = NormalButtonType
toEnum 1 = ToggleButtonType
toEnum 3 = HiddenButtonType
toEnum 102 = RadioButtonType
toEnum unmatched = error ("ButtonType.toEnum: Cannot match " ++ show unmatched)
{-# LINE 219 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data TreeReasonType = TreeReasonNone
| TreeReasonSelected
| TreeReasonDeselected
| TreeReasonOpened
| TreeReasonClosed
| TreeReasonDragged
deriving (Show,Eq)
instance Enum TreeReasonType where
succ TreeReasonNone = TreeReasonSelected
succ TreeReasonSelected = TreeReasonDeselected
succ TreeReasonDeselected = TreeReasonOpened
succ TreeReasonOpened = TreeReasonClosed
succ TreeReasonClosed = TreeReasonDragged
succ TreeReasonDragged = error "TreeReasonType.succ: TreeReasonDragged has no successor"
pred TreeReasonSelected = TreeReasonNone
pred TreeReasonDeselected = TreeReasonSelected
pred TreeReasonOpened = TreeReasonDeselected
pred TreeReasonClosed = TreeReasonOpened
pred TreeReasonDragged = TreeReasonClosed
pred TreeReasonNone = error "TreeReasonType.pred: TreeReasonNone has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from TreeReasonDragged
fromEnum TreeReasonNone = 0
fromEnum TreeReasonSelected = 1
fromEnum TreeReasonDeselected = 2
fromEnum TreeReasonOpened = 3
fromEnum TreeReasonClosed = 4
fromEnum TreeReasonDragged = 5
toEnum 0 = TreeReasonNone
toEnum 1 = TreeReasonSelected
toEnum 2 = TreeReasonDeselected
toEnum 3 = TreeReasonOpened
toEnum 4 = TreeReasonClosed
toEnum 5 = TreeReasonDragged
toEnum unmatched = error ("TreeReasonType.toEnum: Cannot match " ++ show unmatched)
{-# LINE 220 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data MenuItemFlag = MenuItemNormal
| MenuItemInactive
| MenuItemToggle
| MenuItemValue
| MenuItemRadio
| MenuItemInvisible
| SubmenuPointer
| Submenu
| MenuItemDivider
| MenuItemHorizontal
deriving (Show,Eq,Ord)
instance Enum MenuItemFlag where
succ MenuItemNormal = MenuItemInactive
succ MenuItemInactive = MenuItemToggle
succ MenuItemToggle = MenuItemValue
succ MenuItemValue = MenuItemRadio
succ MenuItemRadio = MenuItemInvisible
succ MenuItemInvisible = SubmenuPointer
succ SubmenuPointer = Submenu
succ Submenu = MenuItemDivider
succ MenuItemDivider = MenuItemHorizontal
succ MenuItemHorizontal = error "MenuItemFlag.succ: MenuItemHorizontal has no successor"
pred MenuItemInactive = MenuItemNormal
pred MenuItemToggle = MenuItemInactive
pred MenuItemValue = MenuItemToggle
pred MenuItemRadio = MenuItemValue
pred MenuItemInvisible = MenuItemRadio
pred SubmenuPointer = MenuItemInvisible
pred Submenu = SubmenuPointer
pred MenuItemDivider = Submenu
pred MenuItemHorizontal = MenuItemDivider
pred MenuItemNormal = error "MenuItemFlag.pred: MenuItemNormal has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from MenuItemHorizontal
fromEnum MenuItemNormal = 0
fromEnum MenuItemInactive = 1
fromEnum MenuItemToggle = 2
fromEnum MenuItemValue = 4
fromEnum MenuItemRadio = 8
fromEnum MenuItemInvisible = 16
fromEnum SubmenuPointer = 32
fromEnum Submenu = 64
fromEnum MenuItemDivider = 128
fromEnum MenuItemHorizontal = 256
toEnum 0 = MenuItemNormal
toEnum 1 = MenuItemInactive
toEnum 2 = MenuItemToggle
toEnum 4 = MenuItemValue
toEnum 8 = MenuItemRadio
toEnum 16 = MenuItemInvisible
toEnum 32 = SubmenuPointer
toEnum 64 = Submenu
toEnum 128 = MenuItemDivider
toEnum 256 = MenuItemHorizontal
toEnum unmatched = error ("MenuItemFlag.toEnum: Cannot match " ++ show unmatched)
{-# LINE 221 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data ColorChooserMode = RgbMode
| ByteMode
| HexMode
| HsvMode
deriving (Show,Eq,Ord)
instance Enum ColorChooserMode where
succ RgbMode = ByteMode
succ ByteMode = HexMode
succ HexMode = HsvMode
succ HsvMode = error "ColorChooserMode.succ: HsvMode has no successor"
pred ByteMode = RgbMode
pred HexMode = ByteMode
pred HsvMode = HexMode
pred RgbMode = error "ColorChooserMode.pred: RgbMode has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from HsvMode
fromEnum RgbMode = 0
fromEnum ByteMode = 1
fromEnum HexMode = 2
fromEnum HsvMode = 3
toEnum 0 = RgbMode
toEnum 1 = ByteMode
toEnum 2 = HexMode
toEnum 3 = HsvMode
toEnum unmatched = error ("ColorChooserMode.toEnum: Cannot match " ++ show unmatched)
{-# LINE 222 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
newtype MenuItemFlags = MenuItemFlags [MenuItemFlag] deriving Show
allMenuItemFlags :: [MenuItemFlag]
allMenuItemFlags =
[
MenuItemInactive,
MenuItemToggle,
MenuItemValue,
MenuItemRadio,
MenuItemInvisible,
SubmenuPointer,
Submenu,
MenuItemDivider,
MenuItemHorizontal
]
data CursorType = NormalCursor
| CaretCursor
| DimCursor
| BlockCursor
| HeavyCursor
| SimpleCursor
deriving (Show,Eq)
instance Enum CursorType where
succ NormalCursor = CaretCursor
succ CaretCursor = DimCursor
succ DimCursor = BlockCursor
succ BlockCursor = HeavyCursor
succ HeavyCursor = SimpleCursor
succ SimpleCursor = error "CursorType.succ: SimpleCursor has no successor"
pred CaretCursor = NormalCursor
pred DimCursor = CaretCursor
pred BlockCursor = DimCursor
pred HeavyCursor = BlockCursor
pred SimpleCursor = HeavyCursor
pred NormalCursor = error "CursorType.pred: NormalCursor has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from SimpleCursor
fromEnum NormalCursor = 0
fromEnum CaretCursor = 1
fromEnum DimCursor = 2
fromEnum BlockCursor = 3
fromEnum HeavyCursor = 4
fromEnum SimpleCursor = 5
toEnum 0 = NormalCursor
toEnum 1 = CaretCursor
toEnum 2 = DimCursor
toEnum 3 = BlockCursor
toEnum 4 = HeavyCursor
toEnum 5 = SimpleCursor
toEnum unmatched = error ("CursorType.toEnum: Cannot match " ++ show unmatched)
{-# LINE 237 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data PositionType = CursorPos
| CharacterPos
deriving (Show,Eq)
instance Enum PositionType where
succ CursorPos = CharacterPos
succ CharacterPos = error "PositionType.succ: CharacterPos has no successor"
pred CharacterPos = CursorPos
pred CursorPos = error "PositionType.pred: CursorPos has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from CharacterPos
fromEnum CursorPos = 0
fromEnum CharacterPos = 1
toEnum 0 = CursorPos
toEnum 1 = CharacterPos
toEnum unmatched = error ("PositionType.toEnum: Cannot match " ++ show unmatched)
{-# LINE 238 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data DragType = DragNone
| DragStartDnd
| DragChar
| DragWord
| DragLine
deriving (Show,Eq)
instance Enum DragType where
succ DragNone = DragStartDnd
succ DragStartDnd = DragChar
succ DragChar = DragWord
succ DragWord = DragLine
succ DragLine = error "DragType.succ: DragLine has no successor"
pred DragStartDnd = DragNone
pred DragChar = DragStartDnd
pred DragWord = DragChar
pred DragLine = DragWord
pred DragNone = error "DragType.pred: DragNone has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from DragLine
fromEnum DragNone = (-2)
fromEnum DragStartDnd = (-1)
fromEnum DragChar = 0
fromEnum DragWord = 1
fromEnum DragLine = 2
toEnum (-2) = DragNone
toEnum (-1) = DragStartDnd
toEnum 0 = DragChar
toEnum 1 = DragWord
toEnum 2 = DragLine
toEnum unmatched = error ("DragType.toEnum: Cannot match " ++ show unmatched)
{-# LINE 239 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data WrapTypeFl = WrapNoneFl
| WrapAtColumnFl
| WrapAtPixelFl
| WrapAtBoundsFl
deriving (Show,Eq)
instance Enum WrapTypeFl where
succ WrapNoneFl = WrapAtColumnFl
succ WrapAtColumnFl = WrapAtPixelFl
succ WrapAtPixelFl = WrapAtBoundsFl
succ WrapAtBoundsFl = error "WrapTypeFl.succ: WrapAtBoundsFl has no successor"
pred WrapAtColumnFl = WrapNoneFl
pred WrapAtPixelFl = WrapAtColumnFl
pred WrapAtBoundsFl = WrapAtPixelFl
pred WrapNoneFl = error "WrapTypeFl.pred: WrapNoneFl has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from WrapAtBoundsFl
fromEnum WrapNoneFl = 0
fromEnum WrapAtColumnFl = 1
fromEnum WrapAtPixelFl = 2
fromEnum WrapAtBoundsFl = 3
toEnum 0 = WrapNoneFl
toEnum 1 = WrapAtColumnFl
toEnum 2 = WrapAtPixelFl
toEnum 3 = WrapAtBoundsFl
toEnum unmatched = error ("WrapTypeFl.toEnum: Cannot match " ++ show unmatched)
{-# LINE 240 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data WrapType = WrapNone | WrapAtColumn ColumnNumber | WrapAtPixel PixelPosition | WrapAtBounds deriving (Eq, Show)
data PageFormat = A0
| A1
| A2
| A3
| A4
| A5
| A6
| A7
| A8
| A9
| B0
| B1
| B2
| B3
| B4
| B5
| B6
| B7
| B8
| B9
| B10
| C5E
| DLE
| Executive
| Folio
| Ledger
| Legal
| Letter
| Tabloid
| Envelope
| Media
deriving (Show,Eq)
instance Enum PageFormat where
succ A0 = A1
succ A1 = A2
succ A2 = A3
succ A3 = A4
succ A4 = A5
succ A5 = A6
succ A6 = A7
succ A7 = A8
succ A8 = A9
succ A9 = B0
succ B0 = B1
succ B1 = B2
succ B2 = B3
succ B3 = B4
succ B4 = B5
succ B5 = B6
succ B6 = B7
succ B7 = B8
succ B8 = B9
succ B9 = B10
succ B10 = C5E
succ C5E = DLE
succ DLE = Executive
succ Executive = Folio
succ Folio = Ledger
succ Ledger = Legal
succ Legal = Letter
succ Letter = Tabloid
succ Tabloid = Envelope
succ Envelope = Media
succ Media = error "PageFormat.succ: Media has no successor"
pred A1 = A0
pred A2 = A1
pred A3 = A2
pred A4 = A3
pred A5 = A4
pred A6 = A5
pred A7 = A6
pred A8 = A7
pred A9 = A8
pred B0 = A9
pred B1 = B0
pred B2 = B1
pred B3 = B2
pred B4 = B3
pred B5 = B4
pred B6 = B5
pred B7 = B6
pred B8 = B7
pred B9 = B8
pred B10 = B9
pred C5E = B10
pred DLE = C5E
pred Executive = DLE
pred Folio = Executive
pred Ledger = Folio
pred Legal = Ledger
pred Letter = Legal
pred Tabloid = Letter
pred Envelope = Tabloid
pred Media = Envelope
pred A0 = error "PageFormat.pred: A0 has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from Media
fromEnum A0 = 0
fromEnum A1 = 1
fromEnum A2 = 2
fromEnum A3 = 3
fromEnum A4 = 4
fromEnum A5 = 5
fromEnum A6 = 6
fromEnum A7 = 7
fromEnum A8 = 8
fromEnum A9 = 9
fromEnum B0 = 10
fromEnum B1 = 11
fromEnum B2 = 12
fromEnum B3 = 13
fromEnum B4 = 14
fromEnum B5 = 15
fromEnum B6 = 16
fromEnum B7 = 17
fromEnum B8 = 18
fromEnum B9 = 19
fromEnum B10 = 20
fromEnum C5E = 21
fromEnum DLE = 22
fromEnum Executive = 23
fromEnum Folio = 24
fromEnum Ledger = 25
fromEnum Legal = 26
fromEnum Letter = 27
fromEnum Tabloid = 28
fromEnum Envelope = 29
fromEnum Media = 4096
toEnum 0 = A0
toEnum 1 = A1
toEnum 2 = A2
toEnum 3 = A3
toEnum 4 = A4
toEnum 5 = A5
toEnum 6 = A6
toEnum 7 = A7
toEnum 8 = A8
toEnum 9 = A9
toEnum 10 = B0
toEnum 11 = B1
toEnum 12 = B2
toEnum 13 = B3
toEnum 14 = B4
toEnum 15 = B5
toEnum 16 = B6
toEnum 17 = B7
toEnum 18 = B8
toEnum 19 = B9
toEnum 20 = B10
toEnum 21 = C5E
toEnum 22 = DLE
toEnum 23 = Executive
toEnum 24 = Folio
toEnum 25 = Ledger
toEnum 26 = Legal
toEnum 27 = Letter
toEnum 28 = Tabloid
toEnum 29 = Envelope
toEnum 4096 = Media
toEnum unmatched = error ("PageFormat.toEnum: Cannot match " ++ show unmatched)
{-# LINE 242 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data PageLayout = Portrait
| Landscape
| Reversed
| Orientation
deriving (Show,Eq)
instance Enum PageLayout where
succ Portrait = Landscape
succ Landscape = Reversed
succ Reversed = Orientation
succ Orientation = error "PageLayout.succ: Orientation has no successor"
pred Landscape = Portrait
pred Reversed = Landscape
pred Orientation = Reversed
pred Portrait = error "PageLayout.pred: Portrait has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from Orientation
fromEnum Portrait = 0
fromEnum Landscape = 256
fromEnum Reversed = 512
fromEnum Orientation = 768
toEnum 0 = Portrait
toEnum 256 = Landscape
toEnum 512 = Reversed
toEnum 768 = Orientation
toEnum unmatched = error ("PageLayout.toEnum: Cannot match " ++ show unmatched)
{-# LINE 243 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data TableRowSelectMode = SelectNone
| SelectSingle
| SelectMulti
deriving (Show,Eq)
instance Enum TableRowSelectMode where
succ SelectNone = SelectSingle
succ SelectSingle = SelectMulti
succ SelectMulti = error "TableRowSelectMode.succ: SelectMulti has no successor"
pred SelectSingle = SelectNone
pred SelectMulti = SelectSingle
pred SelectNone = error "TableRowSelectMode.pred: SelectNone has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from SelectMulti
fromEnum SelectNone = 0
fromEnum SelectSingle = 1
fromEnum SelectMulti = 2
toEnum 0 = SelectNone
toEnum 1 = SelectSingle
toEnum 2 = SelectMulti
toEnum unmatched = error ("TableRowSelectMode.toEnum: Cannot match " ++ show unmatched)
{-# LINE 244 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data TableContext = ContextNone
| ContextStartPage
| ContextEndPage
| ContextRowHeader
| ContextColHeader
| ContextCell
| ContextTable
| ContextRCResize
deriving (Show,Eq)
instance Enum TableContext where
succ ContextNone = ContextStartPage
succ ContextStartPage = ContextEndPage
succ ContextEndPage = ContextRowHeader
succ ContextRowHeader = ContextColHeader
succ ContextColHeader = ContextCell
succ ContextCell = ContextTable
succ ContextTable = ContextRCResize
succ ContextRCResize = error "TableContext.succ: ContextRCResize has no successor"
pred ContextStartPage = ContextNone
pred ContextEndPage = ContextStartPage
pred ContextRowHeader = ContextEndPage
pred ContextColHeader = ContextRowHeader
pred ContextCell = ContextColHeader
pred ContextTable = ContextCell
pred ContextRCResize = ContextTable
pred ContextNone = error "TableContext.pred: ContextNone has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from ContextRCResize
fromEnum ContextNone = 0
fromEnum ContextStartPage = 1
fromEnum ContextEndPage = 2
fromEnum ContextRowHeader = 4
fromEnum ContextColHeader = 8
fromEnum ContextCell = 16
fromEnum ContextTable = 32
fromEnum ContextRCResize = 64
toEnum 0 = ContextNone
toEnum 1 = ContextStartPage
toEnum 2 = ContextEndPage
toEnum 4 = ContextRowHeader
toEnum 8 = ContextColHeader
toEnum 16 = ContextCell
toEnum 32 = ContextTable
toEnum 64 = ContextRCResize
toEnum unmatched = error ("TableContext.toEnum: Cannot match " ++ show unmatched)
{-# LINE 245 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data LinePosition = LinePositionTop
| LinePositionBottom
| LinePositionMiddle
deriving (Show,Eq)
instance Enum LinePosition where
succ LinePositionTop = LinePositionBottom
succ LinePositionBottom = LinePositionMiddle
succ LinePositionMiddle = error "LinePosition.succ: LinePositionMiddle has no successor"
pred LinePositionBottom = LinePositionTop
pred LinePositionMiddle = LinePositionBottom
pred LinePositionTop = error "LinePosition.pred: LinePositionTop has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from LinePositionMiddle
fromEnum LinePositionTop = 0
fromEnum LinePositionBottom = 1
fromEnum LinePositionMiddle = 2
toEnum 0 = LinePositionTop
toEnum 1 = LinePositionBottom
toEnum 2 = LinePositionMiddle
toEnum unmatched = error ("LinePosition.toEnum: Cannot match " ++ show unmatched)
{-# LINE 246 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data ScrollbarMode = HorizontalScrollBar
| VerticalScrollBar
| BothScrollBar
| AlwaysOnScrollBar
| HorizontalAlwaysScrollBar
| VerticalAlwaysScrollBar
| BothAlwaysScrollBar
deriving (Show,Eq)
instance Enum ScrollbarMode where
succ HorizontalScrollBar = VerticalScrollBar
succ VerticalScrollBar = BothScrollBar
succ BothScrollBar = AlwaysOnScrollBar
succ AlwaysOnScrollBar = HorizontalAlwaysScrollBar
succ HorizontalAlwaysScrollBar = VerticalAlwaysScrollBar
succ VerticalAlwaysScrollBar = BothAlwaysScrollBar
succ BothAlwaysScrollBar = error "ScrollbarMode.succ: BothAlwaysScrollBar has no successor"
pred VerticalScrollBar = HorizontalScrollBar
pred BothScrollBar = VerticalScrollBar
pred AlwaysOnScrollBar = BothScrollBar
pred HorizontalAlwaysScrollBar = AlwaysOnScrollBar
pred VerticalAlwaysScrollBar = HorizontalAlwaysScrollBar
pred BothAlwaysScrollBar = VerticalAlwaysScrollBar
pred HorizontalScrollBar = error "ScrollbarMode.pred: HorizontalScrollBar has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from BothAlwaysScrollBar
fromEnum HorizontalScrollBar = 1
fromEnum VerticalScrollBar = 2
fromEnum BothScrollBar = 3
fromEnum AlwaysOnScrollBar = 4
fromEnum HorizontalAlwaysScrollBar = 5
fromEnum VerticalAlwaysScrollBar = 6
fromEnum BothAlwaysScrollBar = 7
toEnum 1 = HorizontalScrollBar
toEnum 2 = VerticalScrollBar
toEnum 3 = BothScrollBar
toEnum 4 = AlwaysOnScrollBar
toEnum 5 = HorizontalAlwaysScrollBar
toEnum 6 = VerticalAlwaysScrollBar
toEnum 7 = BothAlwaysScrollBar
toEnum unmatched = error ("ScrollbarMode.toEnum: Cannot match " ++ show unmatched)
{-# LINE 247 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data StyleTableEntry = StyleTableEntry (Maybe Color) (Maybe Font) (Maybe FontSize) deriving Show
data PackType = PackVertical
| PackHorizontal
deriving (Show,Eq,Ord)
instance Enum PackType where
succ PackVertical = PackHorizontal
succ PackHorizontal = error "PackType.succ: PackHorizontal has no successor"
pred PackHorizontal = PackVertical
pred PackVertical = error "PackType.pred: PackVertical has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from PackHorizontal
fromEnum PackVertical = 0
fromEnum PackHorizontal = 1
toEnum 0 = PackVertical
toEnum 1 = PackHorizontal
toEnum unmatched = error ("PackType.toEnum: Cannot match " ++ show unmatched)
{-# LINE 250 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data GLUTproc = GLUTproc ((C2HSImp.FunPtr (IO ()))) deriving Show
newtype GLUTIdleFunction = GLUTIdleFunction (FunPtr (IO ()))
newtype GLUTMenuStateFunction = GLUTMenuStateFunction (FunPtr (CInt -> IO()))
newtype GLUTMenuStatusFunction = GLUTMenuStatusFunction
(FunPtr (CInt -> CInt -> CInt -> IO ()))
newtype GlutBitmapFontPtr = GlutBitmapFontPtr (C2HSImp.Ptr (GlutBitmapFontPtr))
{-# LINE 257 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
newtype GlutStrokeVertexPtr = GlutStrokeVertexPtr (C2HSImp.Ptr (GlutStrokeVertexPtr))
{-# LINE 258 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
newtype GlutStrokeStripPtr = GlutStrokeStripPtr (C2HSImp.Ptr (GlutStrokeStripPtr))
{-# LINE 259 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
newtype GlutStrokeFontPtr = GlutStrokeFontPtr (C2HSImp.Ptr (GlutStrokeFontPtr))
{-# LINE 260 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
type FlShortcut = (C2HSImp.CUInt)
{-# LINE 261 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
type FlColor = (C2HSImp.CUInt)
{-# LINE 262 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
type FlFont = (C2HSImp.CInt)
{-# LINE 263 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
type FlAlign = (C2HSImp.CUInt)
{-# LINE 264 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
type LineDelta = Maybe Int
type Delta = Maybe Int
type FlIntPtr = (C2HSImp.CLong)
{-# LINE 267 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
type FlUIntPtr = (C2HSImp.CULong)
{-# LINE 268 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
type ID = ((C2HSImp.Ptr ()))
{-# LINE 269 "src/Graphics/UI/FLTK/LowLevel/Fl_Types.chs" #-}
data Ref a = Ref !(ForeignPtr (Ptr ())) deriving (Eq, Show)
data FunRef = FunRef !(FunPtr ())
data CBase parent
type Base = CBase ()
type GlobalCallback = IO ()
type CallbackWithUserDataPrim = Ptr () -> Ptr () -> IO ()
type CallbackPrim = Ptr () -> IO ()
type ColorAverageCallbackPrim = Ptr () -> CUInt -> CFloat -> IO ()
type ImageDrawCallbackPrim = Ptr () -> CInt -> CInt -> CInt -> CInt -> CInt -> CInt -> IO ()
type ImageCopyCallbackPrim = Ptr () -> CInt -> CInt -> IO (Ptr ())
type GlobalEventHandlerPrim = CInt -> IO CInt
type GlobalEventHandlerF = Event -> IO Int
type DrawCallback = T.Text -> Position -> IO ()
type DrawCallbackPrim = CString -> CInt -> CInt -> CInt -> IO ()
type TextBufferCallback = FunPtr (Ptr () -> IO ())
type FileChooserCallback = FunPtr (Ptr () -> Ptr () -> IO())
type SharedImageHandler = FunPtr (CString -> CUChar -> CInt -> Ptr ())
type BoxDrawF = Rectangle -> Color -> IO ()
type BoxDrawFPrim = CInt -> CInt -> CInt -> CInt -> FlColor -> IO ()
type FDHandlerPrim = CInt -> Ptr () -> IO ()
type FDHandler = CInt -> IO ()
type TextModifyCb = Int -> Int -> Int -> Int -> T.Text -> IO ()
type TextModifyCbPrim = CInt -> CInt -> CInt -> CInt -> Ptr CChar -> Ptr () -> IO ()
type TextPredeleteCb = BufferOffset -> Int -> IO ()
type TextPredeleteCbPrim = CInt -> CInt -> Ptr () -> IO ()
type UnfinishedStyleCb = BufferOffset -> IO ()
type UnfinishedStyleCbPrim = CInt -> Ptr () -> IO ()
newtype Width = Width Int deriving (Eq, Show)
newtype Height = Height Int deriving (Eq, Show)
newtype Depth = Depth Int deriving Show
newtype LineSize = LineSize Int deriving Show
newtype X = X Int deriving (Eq, Show)
newtype Y = Y Int deriving (Eq, Show)
newtype ByX = ByX Double deriving Show
newtype ByY = ByY Double deriving Show
newtype Angle = Angle CShort deriving Show
data Position = Position X Y deriving (Eq,Show)
data CountDirection = CountUp | CountDown deriving Show
data DPI = DPI Float Float deriving Show
newtype TextDisplayStyle = TextDisplayStyle CInt deriving Show
newtype BufferOffset = BufferOffset Int deriving Show
data BufferRange = BufferRange BufferOffset BufferOffset deriving Show
statusToBufferRange :: (Ptr CInt -> Ptr CInt -> IO Int) -> IO (Maybe BufferRange)
statusToBufferRange f =
alloca $ \start' ->
alloca $ \end' ->
f start' end' >>= \status' ->
case status' of
0 -> return Nothing
_ -> do
start'' <- peekIntConv start'
end'' <- peekIntConv end'
return (Just (BufferRange (BufferOffset start'') (BufferOffset end'')))
data ColorChooserRGB = Decimals (Between0And1, Between0And1, Between0And1) | Words RGB deriving Show
data Rectangle = Rectangle Position Size deriving (Eq,Show)
data ByXY = ByXY ByX ByY deriving Show
data Intersection = Contained | Partial deriving Show
data Size = Size Width Height deriving (Eq, Show)
newtype LineNumber = LineNumber Int deriving (Eq,Show,Ord)
newtype ColumnNumber = ColumnNumber Int deriving (Eq, Show, Ord)
newtype PixelPosition = PixelPosition Int deriving (Eq,Show,Ord)
data KeyType = SpecialKeyType SpecialKey | NormalKeyType Char deriving (Show, Eq)
data ShortcutKeySequence = ShortcutKeySequence [EventState] KeyType deriving Show
data Shortcut = KeySequence ShortcutKeySequence | KeyFormat T.Text deriving Show
data KeyBindingKeySequence = KeyBindingKeySequence (Maybe [EventState]) KeyType deriving Show
newtype Between0And1 = Between0And1 Double deriving Show
newtype Between0And6 = Between0And6 Double deriving Show
data ScreenLocation = Intersect Rectangle
| ScreenNumber Int
| ScreenPosition Position deriving Show
newtype FontSize = FontSize CInt deriving Show
newtype PixmapHs = PixmapHs [T.Text] deriving Show
data BitmapHs = BitmapHs B.ByteString Size deriving Show
data Clipboard = InternalClipboard | SharedClipboard deriving Show
data UnknownEvent = UnknownEvent deriving Show
successOrUnknownEvent :: Int -> Either UnknownEvent ()
successOrUnknownEvent status = if (status == 0) then Left UnknownEvent else Right ()
data UnknownError = UnknownError deriving Show
successOrUnknownError :: a -> Bool -> (a -> IO b) -> IO (Either UnknownError b)
successOrUnknownError a pred' tr = if pred' then return (Left UnknownError) else tr a >>= return . Right
data NotFound = NotFound deriving Show
data OutOfRange = OutOfRange deriving Show
successOrOutOfRange :: a -> Bool -> (a -> IO b) -> IO (Either OutOfRange b)
successOrOutOfRange a pred' tr = if pred' then return (Left OutOfRange) else tr a >>= return . Right
data NoChange = NoChange deriving Show
successOrNoChange :: Int -> Either NoChange ()
successOrNoChange status = if (status == 0) then Left NoChange else Right ()
data DataProcessingError = NoDataProcessedError | PartialDataProcessedError | UnknownDataError Int
successOrDataProcessingError :: Int -> Either DataProcessingError ()
successOrDataProcessingError status = case status of
0 -> Right ()
1 -> Left NoDataProcessedError
2 -> Left PartialDataProcessedError
x -> Left $ UnknownDataError x
toRectangle :: (Int,Int,Int,Int) -> Rectangle
toRectangle (x_pos, y_pos, width, height) =
Rectangle (Position
(X x_pos)
(Y y_pos))
(Size
(Width width)
(Height height))
fromRectangle :: Rectangle -> (Int,Int,Int,Int)
fromRectangle (Rectangle (Position
(X x_pos)
(Y y_pos))
(Size
(Width width)
(Height height))) =
(x_pos, y_pos, width, height)
toSize :: (Int, Int) -> Size
toSize (width', height') = Size (Width width') (Height height')
toPosition :: (Int,Int) -> Position
toPosition (xPos', yPos') = Position (X xPos') (Y yPos')
throwStackOnError :: IO a -> IO a
throwStackOnError f =
f `catch` throwStack
where
throwStack :: SomeException -> IO b
throwStack e = traceStack (show e) $ error ""
withForeignPtrs :: [ForeignPtr a] -> ([Ptr a] -> IO c) -> IO c
withForeignPtrs fptrs io = do
let ptrs = map Unsafe.unsafeForeignPtrToPtr fptrs
r <- io ptrs
mapM_ touchForeignPtr fptrs
return r
toRefPtr :: HasCallStack => Ptr (Ptr a) -> IO (Ptr a)
toRefPtr ptrToRefPtr = do
refPtr <- peek ptrToRefPtr
if (refPtr == nullPtr)
then error $ "Ref does not exist. " ++ (prettyCallStack callStack)
else return refPtr
withRef :: HasCallStack => Ref a -> (Ptr b -> IO c) -> IO c
withRef (Ref fptr) f =
throwStackOnError $
withForeignPtr fptr
(\ptrToRefPtr -> do
refPtr <- toRefPtr ptrToRefPtr
f (castPtr refPtr)
)
isNull :: Ref a -> IO Bool
isNull (Ref fptr) =
withForeignPtr fptr $
(\ptrToRefPtr -> do
refPtr <- peek ptrToRefPtr
if (refPtr == nullPtr)
then return True
else return False
)
unsafeRefToPtr :: Ref a -> IO (Ptr ())
unsafeRefToPtr (Ref fptr) =
throwStackOnError $ do
refPtr <- toRefPtr $ Unsafe.unsafeForeignPtrToPtr fptr
return $ castPtr refPtr
withRefs :: [Ref a] -> (Ptr (Ptr b) -> IO c) -> IO c
withRefs refs f =
throwStackOnError
$ withForeignPtrs
(map (\(Ref fptr) -> fptr) refs)
(\ptrToRefPtrs -> do
refPtrs <- mapM toRefPtr ptrToRefPtrs
arrayPtr <- newArray refPtrs
f (castPtr arrayPtr)
)
withMaybeRef :: Maybe (Ref a) -> (Ptr () -> IO c) -> IO c
withMaybeRef (Just o) f = withRef o f
withMaybeRef Nothing f = f (castPtr nullPtr)
swapRef :: Ref a -> (Ptr b -> IO (Ptr ())) -> IO ()
swapRef ref@(Ref fptr) f = do
result <- withRef ref f
withForeignPtr fptr $ \p -> poke p result
wrapInRef :: ForeignPtr (Ptr ()) -> Ref a
wrapInRef = Ref . castForeignPtr
toFunRef :: FunPtr a -> FunRef
toFunRef fptr = FunRef $ castFunPtr fptr
fromFunRef :: FunRef -> (FunPtr ())
fromFunRef (FunRef f) = castFunPtr f