diff options
author | Benjamin Barenblat <bbaren@mit.edu> | 2015-02-11 20:51:34 -0500 |
---|---|---|
committer | Benjamin Barenblat <bbaren@mit.edu> | 2015-02-11 20:51:34 -0500 |
commit | a5647e17247232f8cb05379ce046142248810f31 (patch) | |
tree | 8120237c238dd7719003c6ec1efaaecb576ffe30 /src/Fragment.hs | |
parent | b020a5f7783294770b3ead5b969f108733be7711 (diff) |
Fragment: Give up and use pattern matching
I’m normally opposed to pattern matching in high-quality apps, but this
is so small that I’m unconvinced it’ll be a problem. I can always
switch to explicit accessors if things get too coupled.
Diffstat (limited to 'src/Fragment.hs')
-rw-r--r-- | src/Fragment.hs | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/src/Fragment.hs b/src/Fragment.hs index 14172da..6850662 100644 --- a/src/Fragment.hs +++ b/src/Fragment.hs @@ -12,11 +12,8 @@ PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. -} -{-# LANGUAGE RecordWildCards #-} -module Fragment ( Fragment +module Fragment ( Fragment(..) , CodeOrReference(..) - , isBlockCode - , blockName, blockContents , parseStdin , parseFile) where @@ -34,18 +31,6 @@ data Fragment = Documentation String | BlockCode String [CodeOrReference] deriving (Eq, Show, Data, Typeable, Generic) -isBlockCode :: Fragment -> Bool -isBlockCode (Documentation {..}) = False -isBlockCode (BlockCode {..}) = True - -blockName :: Fragment -> String -blockName (Documentation {..}) = error "Documentation fragments are unnamed" -blockName (BlockCode name _) = name - -blockContents :: Fragment -> [CodeOrReference] -blockContents (Documentation {..}) = error "Documentation fragments have no code" -blockContents (BlockCode _ body) = body - data CodeOrReference = Code String | Reference String deriving (Eq, Show, Data, Typeable, Generic) |