aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2018-10-28 21:08:10 +0000
committerYann Herklotz <ymherklotz@gmail.com>2018-10-28 21:10:20 +0000
commit4fd1105b865e5b20ef801c53bcefbd7a7d5474f0 (patch)
tree31069b8e72de575f2892089889704d225cbfa98e
parent62fffd351e92b96ad9ae0c88e6b7d59775594ac3 (diff)
downloadverismith-4fd1105b865e5b20ef801c53bcefbd7a7d5474f0.tar.gz
verismith-4fd1105b865e5b20ef801c53bcefbd7a7d5474f0.zip
Initial commit
-rw-r--r--LICENSE30
-rw-r--r--Setup.hs2
-rw-r--r--src/Main.hs28
-rw-r--r--stack.yaml4
-rw-r--r--verifuzz.cabal21
5 files changed, 85 insertions, 0 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..83e56ab
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,30 @@
+Copyright Author name here (c) 2018
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Author name here nor the names of other
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
index 0000000..9a994af
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/src/Main.hs b/src/Main.hs
new file mode 100644
index 0000000..e25986c
--- /dev/null
+++ b/src/Main.hs
@@ -0,0 +1,28 @@
+module Main where
+
+import Data.Bits
+
+newtype Input = Input { getInput :: Bool }
+ deriving (Show)
+
+data Gate = And
+ | Or
+ | Xor
+ | Nand
+ | Nor
+ deriving (Show)
+
+data Circuit = In Input
+ | Node Gate Circuit Circuit
+ deriving (Show)
+
+eval :: Circuit -> Bool
+eval (In val) = getInput val
+eval (Node And c1 c2) = eval c1 .&. eval c2
+eval (Node Or c1 c2) = eval c1 .|. eval c2
+eval (Node Xor c1 c2) = eval c1 `xor` eval c2
+eval (Node Nand c1 c2) = complement $ eval c1 .&. eval c2
+eval (Node Nor c1 c2) = complement $ eval c1 .|. eval c2
+
+main :: IO ()
+main = print . eval $ Node And (In . Input $ True) (In . Input $ True)
diff --git a/stack.yaml b/stack.yaml
new file mode 100644
index 0000000..2d39e0e
--- /dev/null
+++ b/stack.yaml
@@ -0,0 +1,4 @@
+resolver: lts-12.15
+packages:
+ - .
+extra-deps: []
diff --git a/verifuzz.cabal b/verifuzz.cabal
new file mode 100644
index 0000000..ec4ec70
--- /dev/null
+++ b/verifuzz.cabal
@@ -0,0 +1,21 @@
+name: verifuzz
+version: 0.1.0.0
+-- synopsis:
+-- description:
+homepage: https://github.com/githubuser/verifuzz#readme
+license: BSD3
+license-file: LICENSE
+author: Author name here
+maintainer: example@example.com
+copyright: 2018 Author name here
+category: Web
+build-type: Simple
+cabal-version: >=1.10
+extra-source-files: README.md
+
+executable verifuzz
+ hs-source-dirs: src
+ main-is: Main.hs
+ default-language: Haskell2010
+ build-depends: base >= 4.7 && < 5
+ , QuickCheck