Skip to content

Instantly share code, notes, and snippets.

@fizbin
fizbin / regexequiv.hs
Last active January 19, 2023 22:50
Code to determine whether two regular expressions are equivalent, and if not to find a distinguishing string
{-# OPTIONS_GHC -Wall #-}
module Main (main) where
-- Takes two arguments in a limited regex-like language, and tells if
-- they are equivalent. This equivalence is shown by either saying
-- "there is no string which matches one regex but not the other" or
-- by giving a string which matches one but not the other.
-- (i.e. if the distinguishing string is Just "blah", then the regexes
-- aren't equivalent and onw matches "blah" and the other doesn't. If the