This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
Heterogeneous List Example | |
from | |
Strongly Typed Heterogeneous Collections | |
http://okmij.org/ftp/Haskell/HList-ext.pdf | |
(This HList definition is different from the version in Hackage) | |
-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE TypeOperators #-} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ST Monad Example | |
import Control.Monad.ST (ST) | |
import Control.Monad.ST (runST) | |
import Data.STRef (STRef) | |
import Data.STRef (modifySTRef) | |
import Data.STRef (newSTRef) | |
import Data.STRef (readSTRef) | |
prog :: Int -> ST s Int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ListT Example | |
import Control.Monad.List (ListT(..)) | |
import Control.Monad.State (State) | |
import Control.Monad.State (modify) | |
import Control.Monad.Trans (lift) | |
import Control.Monad.Writer (Writer) | |
import Control.Monad.Writer (tell) | |
liftList :: (Monad m) => [a] -> ListT m a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-| | |
Module : CFPFD | |
Description : Constraint Functional Programming over Finite Domain | |
Copyright : (c) notae@me.com, 2014 | |
License : BSD-style | |
Maintainer : notae@me.com | |
Stability : experimental | |
Portability : POSIX | |
This module provides interfaces for constraint programming |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Example of storing multiple types into single Map using Enum | |
import Control.Monad.State (State) | |
import Control.Monad.State (runState) | |
import Control.Monad.State (evalState) | |
import Control.Monad.State (gets) | |
import Control.Monad.State (modify) | |
import Control.Monad (liftM2) | |
import Data.Map (Map) | |
import Data.Maybe (fromMaybe) |
NewerOlder