packages feed

Hs2lib-0.4.8: Tests/Src/Test_SimpleType.hs

-- | A sample test function that my tool has to be able to convert to be usefull
module Tests.Src.Test_SimpleType where

import Control.Monad
import Control.Monad.Instances

data SimpleType = SimpleType { value :: Int, name :: String }
    deriving Show
data Selector = First 
              | Second
    deriving Show
data TwoCases = NoFields
              | Other SimpleType
    deriving Show 
    
newtype Foo = Bar String
    deriving Show

-- @@ Export
foo :: Int -> String -> String 
foo = const id

-- @@ Match to BAR
-- @@ LOL
-- @@ Export = rachel
-- | This function calculates the value \x->x*x
bar :: Int -> Int
bar = join (*)

-- @@ NO MATCH
                
-- @@ Export
typeTest1 :: Int -> String -> SimpleType
typeTest1 i s = SimpleType i s

-- @@ Export    
typeTest2 :: Selector -> TwoCases
typeTest2 First  = NoFields
typeTest2 Second = Other (SimpleType 0 "Type Testing")