Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active August 31, 2017 21:20
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 deque-blog/4ab18f24db8a201a8d65344b6a5a2462 to your computer and use it in GitHub Desktop.
Save deque-blog/4ab18f24db8a201a8d65344b6a5a2462 to your computer and use it in GitHub Desktop.
logEvent : Event -> List PlaceholderValue -> Maybe String
logEvent e vals = loop (messageSpec e) vals (title e ++ ": ")
where
loop : Schema -> List PlaceholderValue -> String -> Maybe String
loop [] [] out = pure out
loop (IntVar :: xs) (IntVal i :: ys) out = loop xs ys (out ++ show i)
loop (StrVar :: xs) (StrVal s :: ys) out = loop xs ys (out ++ s)
loop (StrCst x :: xs) ys out = loop xs ys (out ++ x)
loop _ _ _ = Nothing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment