Skip to content

Instantly share code, notes, and snippets.

@coreyoconnor
Created January 29, 2014 18:04
Show Gist options
  • Save coreyoconnor/8693470 to your computer and use it in GitHub Desktop.
Save coreyoconnor/8693470 to your computer and use it in GitHub Desktop.
{-# LANGUAGE ExistentialQuantification, DeriveDataTypeable #-}
module Main where
import Data.Typeable
data Highlighter cache syntax = SynHL {hlFocus :: Int -> cache -> cache}
data HLState syntax = forall cache. HLState !(Highlighter cache syntax) !cache
data BufferImpl syntax =
FBufferData { hlCache :: !(HLState syntax) }
deriving Typeable
focusAst :: Int -> BufferImpl syntax -> BufferImpl syntax
focusAst r b@FBufferData {hlCache = HLState s@(SynHL {hlFocus = foc}) cache} = b {hlCache = HLState s (foc r cache)}
main = return ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment