News aggregator

Yesos forms and types with foreign keys

haskell-cafe - Sat, 05/14/2016 - 9:57pm
Hello, I have a question about RESTful web apps in Haskell. I'm using Yesod but I suppose the same question can apply to any other framework with type safety features. Suppose I have entities A and B defined in my Persistent model file. One of A's fields is a foreign key referring to B. Each A has its own unique B. The process of creating a new A would be: 1. Set the user a web form via GET 2. Receive for field data via POST 3. Validate the input 4. Insert a new B value to the DB, and get its ID 5. Define an A value which includes that ID as a foreign key, and insert the new A value to the DB In Yesod, If I use a form of type 'AForm A', running the form must return a complete A value. But when I runFormPost, I don't have the B entity yet so I don't have an ID for the foreign key! Ideas what I can do: - Set that field to some dummy value, and override it later when I insert the B value and get its ID - Define a 'NewA' type which has the same fields as A except for that foreign key field - Insert t
Categories: Offsite Discussion

Call for Papers: WFLP 2016 - Workshop on Functional and (Constraint) Logic Programming

General haskell list - Fri, 05/13/2016 - 6:19pm
24th International Workshop on Functional and (Constraint) Logic Programming (WFLP 2016) https://wflp2016.github.io/ September 13-14, part of the Leipzig Week of Declarative Programming (L-DEC 2016) *********************************************************** Deadlines: * abstract submission: June 15, 2016 * paper submission: June 22, 2016 * notification: July 15, 2016 * final version due: August 10, 2016 *********************************************************** The international workshops on functional and (constraint) logic programming aim at bringing together researchers, students, and practitioners interested in functional programming, logic programming, and their integration. This year the workshop is co-located with two other events as part of http://nfa.imn.htwk-leipzig.de/LDEC2016/ in order to promote the cross-fertilizing exchange of ideas and experiences among and between the communities interested in the foundations, applications, and combinations of high-level, declarative programming lan
Categories: Incoming News

SPLASH-I 2016: Call for Talk Proposals!

General haskell list - Wed, 05/11/2016 - 12:05pm
SPLASH-I: Innovation, Interaction, Insight, Industry, Invited The ACM SIGPLAN conference on Systems, Programming, Languages and Applications: Software for Humanity (SPLASH) embraces all aspects of software construction and delivery to make it the premier conference at the intersection of programming, languages, and software engineering. SPLASH 2016 will take place from Sunday, October 30 to Friday, November 4, 2016 in Amsterdam, The Netherlands. SPLASH-I is the track of SPLASH dedicated to great talks on exciting topics! SPLASH-I will run in parallel with all of SPLASH (during the week days), and is open to all attendees. SPLASH-I will host both invited talks and selected talks submitted via this call for proposals. SPLASH-I solicits inspiring talks, tutorials and demonstrations on exciting topics related to programming and programming systems, delivered by excellent speakers from academia or industry. SPLASH-I caters for three categories of presentations: - Regular talks on programming languages, system
Categories: Incoming News

Template Haskell Tutorial

haskell-cafe - Wed, 05/11/2016 - 11:49am
Hi, I've been diving into Template Haskell recently and thought to write down what I've learned. The result hopes to be a practical, example-driven introduction to Template Haskell's main features: https://wiki.haskell.org/A_practical_Template_Haskell_Tutorial I hope it serves others new to Template Haskell. It's all on the Haskell wiki, so feedback and improvements are welcome! Cheers, Dominik.
Categories: Offsite Discussion

SPLASH 2016: Call for Sponsorships

General haskell list - Tue, 05/10/2016 - 11:54pm
The ACM SIGPLAN conference on Systems, Programming, Languages and Applications: Software for Humanity (SPLASH) embraces all aspects of software construction and delivery to make it the premier conference at the intersection of programming, languages, and software engineering. SPLASH 2016 will take place from Sunday, October 30 to Friday, November 4, 2016 in Amsterdam, The Netherlands. Web version of this call for sponsorships: http://2016.splashcon.org/attending/support-program SPLASH is where the best of the best in software innovation, programming and programming languages convene, learn from and inspire each other, and share their passion for software. Supporting SPLASH is an opportunity to put your corporate name in front of this community — a superb investment for your organization. # Sponsorship Packages ## Diamond: $US 15 000 Benefits: - Recognition as a supporter in print and on the web. Recognized as a Diamond supporter on registration brochures and conference program - Two company-provided i
Categories: Incoming News

OAuth2 and OpenID Connect in Haskell

haskell-cafe - Tue, 05/10/2016 - 10:49pm
Hello all, I've written a blog article as an introduction to the Haskell project I've been working on, which may be of interest to some people here. It's an OpenID Connect identity provider. http://broch.io/posts/oauth2-openid-connect-haskell/ I'd really welcome any feedback on other/better ways of doing some of things it talks about. Cheers, Luke.
Categories: Offsite Discussion

Using parallels for fibonacci

haskell-cafe - Tue, 05/10/2016 - 5:39pm
I am trying to efficiently use multicores for my fizzbuzz <https://github.com/mlitchard/swiftfizz> project. My fizzbuzz uses a Fibonacci generator as input, and this is where it can get computationally heavy. I believe I have picked the best algorithm for my project (please correct this if wrong), and now I am trying to use the parallel package <https://hackage.haskell.org/package/parallel-3.2.1.0>. I am not getting any better performance in the sense that if I try to compute the 100th Fibonacci number, it is still computing , using 4 cores, several minutes later. Here is my attempt. Please show me how to use this library right. from src/FizzBuzz.hs fizzBuzzFib :: Integer -> [Text] fizzBuzzFib ub = parMap rdeepseq fizzbuzz $! fibSeq ub from src/FizzFub.hs fibSeq :: Integer -> [Integer] fibSeq ub = withStrategy (parBuffer buffer rdeepseq) $ genericTake ub fibbwhere buffer = 100 fibb :: [Integer] fibb = 0 : 1 : zipWith (+) fibb (tail fibb) _______________________________________________ Haskell-Cafe ma
Categories: Offsite Discussion

Trustworthy Refactoring project: Research AssociatePositions in Refactoring Functional Programs and FormalVerification (for CakeML)

General haskell list - Tue, 05/10/2016 - 4:33pm
Trustworthy Refactoring project: Research Associate Positions in Refactoring Functional Programs and Formal Verification (for CakeML) The Trustworthy Refactoring project at the University of Kent is seeking to recruit postdoc research associates for two 3.5 year positions, to start in September this year. The overall goal of this project is to make a step change in the practice of refactoring by designing and constructing of trustworthy refactoring tools. By this we mean that when refactorings are performed, the tools will provide strong evidence that the refactoring has not changed the behaviour of the code, built on a solid theoretical understanding of the semantics of the language. Our approach will provide different levels of assurance from the (strongest) case of a fully formal proof that a refactoring can be trusted to work on all programs, given some pre-conditions, to other, more generally applicable guarantees, that a refactoring applied to a particular program does not change the behaviour of t
Categories: Incoming News

Summer of Haskell Mentors

General haskell list - Tue, 05/10/2016 - 3:31am
If you are interesting in helping out as a possible mentor for this year's Summer of Haskell, please email me, and include MENTOR in the title. Thank you! -Edward
Categories: Incoming News

origin of my fibonacci test

haskell-cafe - Tue, 05/10/2016 - 12:59am
I have some code that checks to see if a number is a fibonacci number. It's not mine, I got it from somewhere and I need to credit it. I am pretty sure I got it from Stack Exchange but my search for it went nowhere. If this looks familiar to you, or you can tell me better ways to search, please let me know. isFib :: Integer -> Bool isFib n = n == a where (_, a, _) = unFib (1, 1) n unFib :: (Integer, Integer) -> Integer -> (Integer,Integer,Integer) unFib (a, b) n | n < a = (0, 0, 1) | n < e = (2*k, c, d) | otherwise = (2*k + 1, e, f) where (k, c, d) = unFib (fibPlus (a, b) (a, b)) n (e, f) = fibPlus (a, b) (c, d) fibPlus :: (Integer, Integer) -> (Integer, Integer) -> (Integer,Integer) fibPlus (a, b) (c, d) = (bd - (b - a)*(d - c), a*c + bd) where bd = b*d _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

Myrtle Software is looking for Haskell developers for exciting graphics/compilers/hardware work

haskell-cafe - Mon, 05/09/2016 - 6:08pm
https://www.myrtlesoftware.com/vacancies/ We're a small software company in Cambridge, UK. We are working on some cool tech for lowering image processing algorithms to efficient hardware designs with a focus on putting these in autonomous vehicles. Our compiler is written completely in Haskell as well as some other tools we've written in house. We are looking to hire some more Haskell talent to help drive things forward. Please ask if you have any questions!
Categories: Offsite Discussion

WST 2016 - First Call for Papers

haskell-cafe - Mon, 05/09/2016 - 3:41pm
========================================================================== WST 2016 - 1st Call for Papers 15th International Workshop on Termination September 5-7, 2016, Obergurgl, Austria http://cl-informatik.uibk.ac.at/events/wst-2016/ ========================================================================== The Workshop on Termination (WST) traditionally brings together, in an informal setting, researchers interested in all aspects of termination, whether this interest be practical or theoretical, primary or derived. The workshop also provides a ground for cross-fertilization of ideas from term rewriting and from the different programming language communities. The friendly atmosphere enables fruitful exchanges leading to joint research and subsequent publications. The event is held as part of CLA 2016 http://cl-informatik.uibk.ac.at/events/cla-2016/ IMPORTANT DATES: * submission June 22, 2016 * n
Categories: Offsite Discussion

suboptimal ghc code generation in IO vs equivalent pure code case

glasgow-user - Mon, 05/09/2016 - 3:23pm
I have a loop which runs millions of times. For some reason I have to run it in the IO monad. I noticed that when I convert the code from pure to IO monad the generated assembly code in essence is almost identical except one difference where it puts a piece of code in a separate block which is making a huge difference in performance (4-6x slower). I want to understand what makes GHC to generate code in this way and if there is anything that can be done at source level (or ghc option) to control that. The pure code looks like this: decomposeChars :: [Char] -> [Char] decomposeChars [] = [] decomposeChars [x] = case NFD.isDecomposable x of True -> decomposeChars (NFD.decomposeChar x) False -> [x] decomposeChars (x : xs) = decomposeChars [x] ++ decomposeChars xs The equivalent IO code is this: decomposeStrIO :: [Char] -> IO [Char] decomposeStrPtr !p = decomposeStrIO where decomposeStrIO
Categories: Offsite Discussion

Problems with function recursion in Haskell

haskell-cafe - Mon, 05/09/2016 - 2:30pm
Hi, I'm new in Haskell and I need help in recursion. That function below is returning "*** Exception: Prelude.head: empty list" and I need resolve that: execNTimes 0 [] = return() execNTimes n xs = if n<=0 || null xs then return() else do si <- getLine let s = words si l = read (s !! 1) :: Int r = read (s !! 2) :: Int if head s=="Q" then do let z = slice l r xs m = foldl lcm 1 z print (m `mod` (toInteger 1000000007)) else do let s1 = update l r xs execNTimes (n-1) s1 execNTimes (n-1) xs Anybody can me help? Thank you, Josenildo Silva
Categories: Offsite Discussion

LPTI'16 Call for Papers

General haskell list - Mon, 05/09/2016 - 11:30am
Call for Papers Workshop on Logic Programming for Type Inference 16-17 October 2016, New York, USA https://ff32.host.cs.st-andrews.ac.uk/lpti16/ Objectives and scope ------------------- Two facts are universally acknowledged: critical software must be subject to formal verification and modern verification tools need to scale and become more user-friendly in order to make more impact in industry. There are two major styles of verification: algorithmic : verification problems are specified in an automated prover, e.g. (constraint) logic programming or SMT solver, and properties of interest are verified by the prover automatically. Such provers can be fast, but their trustworthiness is hard to establish without producing and checking proofs. An alternative is a typeful approach to verification: instead of verifying programs in an external prover, a programmer may record all properties of interest as types of functions in his programs. Thanks to Curry-Howard isomorphism, type inhabitants also play the rol
Categories: Incoming News

CFP: WADT 2016

General haskell list - Mon, 05/09/2016 - 11:13am
CFP: WADT 2016 - 23rd International Workshop on Algebraic Development Techniques Link: http://cs.swan.ac.uk/wadt16/ When Sep 21, 2016 - Sep 24, 2016 Where Gregynog, UK Submission Deadline June 3, 2016 Notification June 17, 2016 Final Version Due July 1, 2016 AIMS AND SCOPE The algebraic approach to system specification encompasses many aspects of the formal design of software systems. Originally born as formal method for reasoning about abstract data types, it now covers new specification frameworks and programming paradigms (such as object-oriented, aspect-oriented, agent-oriented, logic and higher-order functional programming) as well as a wide range of application areas (including information systems, concurrent, distributed and mobile systems). The workshop will provide an opportunity to present recent and ongoing work, to meet colleagues, and to discuss new ideas and future trends. TOPICS OF INTEREST Typical, but not exclusive topics of interest are
Categories: Incoming News

CRV 2016 - The 3rd International Competition on RuntimeVerification

General haskell list - Mon, 05/09/2016 - 10:56am
CRV 2016 The 3rd International Competition on Runtime Verification In Association with COST Action “Runtime Verification beyond Monitoring” held with RV 2016, September 23-30 2016, Madrid, Spain https://rv2016.imag.fr/?page_id=188 CRV 2016 is the 3rd International Competition on Runtime Verification and will be held as part of the 16th International Conference on Runtime Verification. The event will be held in September 2016, in Madrid, Spain. CRV-2016 will draw attention to the invaluable effort of software developers and researchers who contribute in this field by providing the community with new or updated tools, libraries and frameworks for the instrumentation and runtime verification of software. The competition is a product of COST Action “Runtime Verification beyond Monitoring”, see https://www.cost-arvi.eu/ <https://www.cost-arvi.eu/> for more information. Runtime Verification is a verification technique for the analysis of software at execution-time based on extracting information from a
Categories: Incoming News

[RV 2016] RV 2016, Deadlines Extended - Abstract: May 20,Paper/Tutorial: May 27

General haskell list - Mon, 05/09/2016 - 8:26am
Following several requests, the deadlines have been extended as follows: - Abstract deadline: Friday May 20 (AoE). - Paper and tutorial deadline: Friday May 27 (AoE). =============================================== RV 2016 16th International Conference on Runtime Verification September 23-30, Madrid, Spain http://rv2016.imag.fr <https://urldefense.proofpoint.com/v2/url?u=http-3A__rv2016.imag.fr&d=BQMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=6AsiS3HGCiiWbQayKR6NFGJTSnU8_M6_CIkQI2NdBtE&m=82hYGGGDEux2KhgphuqIj7RFX2AOXREa86oSYDTT2BE&s=oBZMLSt69qPHnIrDOKsM7YhIH4Sw92LmOgc2Il-XwdE&e=> Scope Runtime verification is concerned with monitoring and analysis of software and hardware system executions. Runtime verification techniques are crucial for system correctness, reliability, and robustness; they are significantly more powerful and versatile than conventional testing, and more practical than exhaustive formal verification. Runtime verification can be used prior to deployment, for testing, verification, and debugging purposes
Categories: Incoming News

Automatic differentiation (AD) with respect to listof matrices in Haskell

haskell-cafe - Sun, 05/08/2016 - 5:04pm
I am trying to understand how can I use Numeric.AD (automatic differentiation) in Haskell. I defined a simple matrix type and a scalar function taking an array and two matrices as arguments. I want to use AD to get the gradient of the scoring function with respect to both matrices, but I'm running into compilation problems. Here is the code: ------------------------------- {-# LANGUAGE DeriveTraversable, DeriveFunctor, DeriveFoldable #-}import Numeric.AD.Mode.Reverse as Rimport Data.Traversable as Timport Data.Foldable as F --- Non-linear function on "vectors" logistic x = 1.0 / (1.0 + exp(-x) ) phi v = map logistic v phi' (x:xs) = x : (phi xs) --- dot product dot u v = foldr (+) 0 $ zipWith (*) u v --- simple matrix typedata Matrix a = M [[a]] deriving (Eq,Show,Functor,F.Foldable,T.Traversable) --- action of a matrix on a vector mv _ [] = [] mv (M []) _ = [] mv ( M m ) v = ( dot (head m) v ) : (mv (M (tail m)) v ) --- two matrices mbW1 = M $ [[1,0,0],[-1,5,1],[1,2,-3]] mbW2 = M $ [[0,0,0],[1,3,-1],[-2,
Categories: Offsite Discussion

Applying a Constraint to a Proxy'd type

haskell-cafe - Sun, 05/08/2016 - 1:15pm
I'm not sure if it's possible (and I have an alternate method of doing this so it isn't strictly speaking _necessary_, but would make the code cleaner if I can), but I would like to convert a "value" of kind (k -> Constraint) into one of kind (Proxy k -> Constraint). I can achieve this using a type family (note: I've also made this polymorphic in terms of the Proxy type used, but that isn't necessary): which has the problem that it can't be partially applied (which I also need). This can be wrapped up in a typeclass: The problem with this is that if I try and use it somewhere that - having already a type of kind (c :: * -> Constraint) from the environment - that expects a function of type (forall a. (c a) => a -> b) with a fixed "b" value, then trying to use something like this function prevents it from working (for the purposes of argument, assume the old specification of Num that had an Eq superclass; this is the way I can produce the smallest example): The resulting error message is: "Could not de
Categories: Offsite Discussion