Re: [Haskell-cafe] Type of scramblings
Hi Roman, On Tue, Oct 9, 2012 at 12:11 PM, Roman Cheplyaka wrote: > I am reading through Oleg's "Eliminating translucent existentials"[1]. > > [1]: > http://okmij.org/ftp/Computation/Existentials.html#eliminating-translucent > > He draws a distinction between > > forall a . [a] -> [a] > > and > > forall a . [a]^n -> [a] > > as types of "scramblings". This is something I'm struggling to understand. > > First of all, I think here we're talking about total functions, otherwise > there's no point in introducing dependent types. > > There are of course more total functions of type `[a]^n -> [a]` than of type > `[a] -> [a]`, in the sense that any term of the latter type can be assigned > the > former type. But, on the other hand, any total function `f :: [a]^n -> [a]` > has an "equivalent" total function > > g :: [a] -> [a] > g xs | length xs == n = f xs >| otherwise = xs > > (The condition `length xs == n` can be replaced by a similar condition that > also > works for infinite lists.) > > The functions `f` and `g` are equivalent in the sense that for any list `xs` > of > length `n` `f xs === g xs`. Thus, even though it seems that we allow more > total > functions by replacing `[a]` with `[a]^n`, that doesn't buy us any additional > expressiveness. > > What am I missing? [a]^n -> [a] is a refinement of [a] -> [a]. The dependent type allows you to infer the number of transformations possible. In this case, the useful case is when n == 0, since with [a]^0 you know that there is only one possible transformation, namely id. In the case where n > 0 there is an infinite number of transformations because you can do countless drops and/or duplications so I think you don't get any additional expressiveness between both types. Regards, Marcelo > > Roman > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] One of the new buzz phrases is "Event-Sourcing"; is Haskell suitable for this?
Hi, On Sun, Sep 30, 2012 at 4:22 AM, Alberto G. Corona wrote: > It´´s a very iteresting concept. > > The Workflow Monad transformer [1], in Control.Workflow perform > logging and recovery of application istate from the log created. > It has no implementation of roll-back or limited recovery upto a > point, but this is easy to implement. Is Control.Workflow similar with acid-state with respect to the way you recovery the current state? > It also has many inspection and synchronization primitives. It has > been used also for translating the log of a program and recovering the > state in another machine. The log can be pretty-printed for > debugging. Can you "somehow" recover impure (IO) computations? > [1] http://hackage.haskell.org/package/Workflow Regards, Marcelo > 2012/9/30 KC : >> http://martinfowler.com/eaaDev/EventSourcing.html >> >> http://martinfowler.com/articles/lmax.html >> >> >> -- >> -- >> Regards, >> KC >> >> ___ >> Haskell-Cafe mailing list >> Haskell-Cafe@haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > -- > Alberto. > > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] bus error trying to use Network
Hi, I'm getting a bus error with Network library on my Mac OS X 10.6.5. I have ghc 6.12.3, network 2.3. As an example: main = withSocketsDo $ do sock <- listenOn $ PortNumber 4244 (handle,host,port) <- accept sock hPutStr handle "Hi!" sClose sock Any idea of what the problem could be? If I use the Network.Socket library it works fine: main = withSocketsDo $ do sock <- socket AF_INET Stream 0 setSocketOption sock ReuseAddr 1 bindSocket sock (SockAddrInet 4244 iNADDR_ANY) listen sock 1 (csock,_) <- accept sock send csock "Hi!\n" sClose csock sClose sock Cheers, Marcelo___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] doesDirectoryExist is always returning False
Hi, I'm having currently a problem with System.Directory in my mac os. System Version: Mac OS X 10.6.5 Kernel Version: Darwin 10.5.0 Prelude System.Directory> let dirTest = do {dir <- getCurrentDirectory; doesDirectoryExist dir} Prelude System.Directory> dirTest False I noticed also that I can't change the searchable field in the permissions record. Prelude System.Directory> getPermissions "." Permissions {readable = True, writable = True, executable = True, searchable = False} I tried different versions of directory and filepath packages but with no success at the moment. Any suggestions?! Regards, Marcelo Sousa___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] yi-editor: Duplicate instance declarations
Hey guys, I'm trying to install yi using cabal but I got this error. Any ideas how to solve it?! I'm using ghc-6.10.1 and cabal-install version 0.6.2 using version 1.6.0.2 of the Cabal library. Thanks, Marcelo -- Code -- $ cabal install yi Resolving dependencies... Configuring yi-0.6.1... Preprocessing library yi-0.6.1... Preprocessing executables for yi-0.6.1... Building yi-0.6.1... [ 1 of 120] Compiling System.FriendlyPath ( System/FriendlyPath.hs, dist/build/System/FriendlyPath.o ) [ 2 of 120] Compiling Shim.ProjectContent ( Shim/ProjectContent.hs, dist/build/Shim/ProjectContent.o ) [ 3 of 120] Compiling Parser.Incremental ( Parser/Incremental.hs, dist/build/Parser/Incremental.o ) [ 4 of 120] Compiling Data.Trie( Data/Trie.hs, dist/build/Data/Trie.o ) [ 5 of 120] Compiling Data.DelayList ( Data/DelayList.hs, dist/build/Data/DelayList.o ) [ 6 of 120] Compiling Data.Rope( Data/Rope.hs, dist/build/Data/Rope.o ) [ 7 of 120] Compiling Data.Prototype ( Data/Prototype.hs, dist/build/Data/Prototype.o ) [ 8 of 120] Compiling HConf.Utils ( HConf/Utils.hs, dist/build/HConf/Utils.o ) [ 9 of 120] Compiling HConf.Paths ( HConf/Paths.hs, dist/build/HConf/Paths.o ) [ 10 of 120] Compiling Paths_yi ( dist/build/autogen/Paths_yi.hs, dist/build/Paths_yi.o ) [ 11 of 120] Compiling HConf( HConf.hs, dist/build/HConf.o ) [ 12 of 120] Compiling Yi.Char.Unicode ( Yi/Char/Unicode.hs, dist/build/Yi/Char/Unicode.o ) [ 13 of 120] Compiling Yi.UI.Common[boot] ( Yi/UI/Common.hs-boot, dist/build/Yi/UI/Common.o-boot ) [ 14 of 120] Compiling Yi.String( Yi/String.hs, dist/build/Yi/String.o ) [ 15 of 120] Compiling Yi.Monad ( Yi/Monad.hs, dist/build/Yi/Monad.o ) [ 16 of 120] Compiling Yi.Keymap.Completion ( Yi/Keymap/Completion.hs, dist/build/Yi/Keymap/Completion.o ) [ 17 of 120] Compiling Yi.Editor[boot] ( Yi/Editor.hs-boot, dist/build/Yi/Editor.o-boot ) [ 18 of 120] Compiling Yi.Debug ( Yi/Debug.hs, dist/build/Yi/Debug.o ) [ 19 of 120] Compiling Yi.Prelude ( Yi/Prelude.hs, dist/build/Yi/Prelude.o ) Yi/Prelude.hs:182:9: Duplicate instance declarations: instance Category Accessor.T -- Defined at Yi/Prelude.hs:182:9-38 instance Category Accessor.T -- Defined in data-accessor-0.2.1:Data.Accessor.Private cabal: Error: some packages failed to install: yi-0.6.1 failed during the building phase. The exception was: exit: ExitFailure 1 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe