Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Casting examples.

  • Loading branch information...
commit 554fc479457ed37d8499c89ba402a6e8987b3e44 1 parent ccfa185
@leepike authored
Showing with 27 additions and 0 deletions.
  1. +27 −0 Examples/Cast.hs
View
27 Examples/Cast.hs
@@ -0,0 +1,27 @@
+--------------------------------------------------------------------------------
+-- Copyright © 2011 National Institute of Aerospace / Galois, Inc.
+--------------------------------------------------------------------------------
+
+{-# LANGUAGE RebindableSyntax #-}
+
+module Main where
+
+import Language.Copilot hiding (even, odd)
+
+b :: Stream Bool
+b = [True] ++ not b
+
+i :: Stream Int8
+i = cast b
+
+x :: Stream Word16
+x = [0] ++ x + 1
+
+y :: Stream Int32
+y = 1 + cast x
+
+spec :: Spec
+spec = trigger "trigger" true [arg y, arg i]
+
+main :: IO ()
+main = interpret 10 [] spec
Please sign in to comment.
Something went wrong with that request. Please try again.