Skip to content

Instantly share code, notes, and snippets.

@qoelet
Created October 1, 2013 14:10
Show Gist options
  • Save qoelet/6779027 to your computer and use it in GitHub Desktop.
Save qoelet/6779027 to your computer and use it in GitHub Desktop.
-- the below will fail
data Type1 = Type1 { title :: String, another :: Integer }
data Type2 = Type2 { title :: String, random :: Integer }
-- with an error of "Multiple declarations of 'title'" or something along the lines
-- Thread on Stackoverflow: http://stackoverflow.com/questions/5367167/haskell-record-syntax
-- My simple cheap workaround was to seperate them into different sub-module files (obviously not scalable)
-- Thanks to Chris Forno (http://jekor.com/) who directed me to possible ways (and new brain food!)
-- 1. Template Haskell (http://www.haskell.org/haskellwiki/Template_Haskell)
-- 2. Lenses (https://github.com/ekmett/lens)
-- Also found TDNR:
-- http://www.haskell.org/haskellwiki/TypeDirectedNameResolution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment