Building.NET GUIs for Haskell applications Beatriz Alarcón Jiménez

Slides:



Advertisements
Similar presentations
.NET Technology. Introduction Overview of.NET What.NET means for Developers, Users and Businesses Two.NET Research Projects:.NET Generics AsmL.
Advertisements

Tahir Nawaz Introduction to.NET Framework. .NET – What Is It? Software platform Language neutral In other words:.NET is not a language (Runtime and a.
Using.NET Platform Note: Most of the material of these slides have been taken & extended from Nakov’s excellent overview for.NET framework, MSDN and wikipedia.
1 A Balanced Introduction to Computer Science, 2/E David Reed, Creighton University ©2008 Pearson Prentice Hall ISBN Chapter 17 JavaScript.
Windows Programming 1 Part 1 dbg --- Getting Acquainted with Visual Studio.NET and C#
CHAPTER TWO Creating Simple Visual Basic.NET Windows Applications.
Introduction to the C# Programming Language for the VB Programmer.
Advanced Object-Oriented Programming Features
Introduction to.NET Microsoft announced in June 2000 A new software –development model that allows applications created in disparate programming languages.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
C# Programming: From Problem Analysis to Program Design1 10 Advanced Object-Oriented Programming Features C# Programming: From Problem Analysis to Program.
Chapter 13: Object-Oriented Programming
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
DT265-2 Object Oriented Software Development 2 Lecture 3 : Windows Programming Lecturer Pat Browne
Getting Started Example ICS2O curriculum
Microsoft Visual Basic 2012 CHAPTER ONE Introduction to Visual Basic 2012 Programming.
Microsoft Visual Basic 2005 CHAPTER 1 Introduction to Visual Basic 2005 Programming.
A Free sample background from © 2001 By Default!Slide 1.NET Overview BY: Pinkesh Desai.
Introduction 01_intro.ppt
Lecture Roger Sutton CO530 Automation Tools 5: Class Libraries and Assemblies 1.
.NET Framework Introduction: Metadata
Introduction to .Net Framework
C++ Programming. Table of Contents History What is C++? Development of C++ Standardized C++ What are the features of C++? What is Object Orientation?
The Metadata System1. 2 Introduction Metadata is data that describes data. Traditionally, metadata has been found in language- specific files (e.g. C/C++
Architecture of.NET Framework .NET Framework ٭ Microsoft.NET (pronounced “dot net”) is a software component that runs on the Windows operating.
Session 1 - Introduction and Data Access Layer
Microsoft Visual Basic 2005: Reloaded Second Edition
Lecture Set 1 Part B: Understanding Visual Studio and.NET – Structure and Terminology 1/16/ :04 PM.
Lesley Bross, August 29, 2010 ArcGIS 10 add-in glossary.
Computer Programming and Basic Software Engineering 9 Building Graphical User Interface Working with Unmanaged Code.
Obsydian OLE Automation Ranjit Sahota Chief Architect Obsydian Development Ranjit Sahota Chief Architect Obsydian Development.
Understanding the CORBA Model. What is CORBA?  The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate.
Assemblies & Namespaces1. 2 Assemblies (1).NET applications are represented by an assembly An assembly is a collection of all software of which the application.
CSCI 3328 Object Oriented Programming in C# Chapter 2: Introduction to Visual C# Programming 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg,
Introduction .NET Framework
Introduction to Programming with Java. Overview What are the tools we are using – What is Java? This is the language that you use to write your program.
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and Server Side Programming Very rich GUI libraries Portability (machine independence) A.
1 Introduction to C# Programming Console applications No visual components Only text output Two types MS-DOS prompt - Used in Windows 95/98/ME Command.
G RAPHICAL U SER I NTERFACE C ONCEPTS : P ART 1 1 Outline Introduction Windows Forms Event-Handling Model - Basic Event Handling.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 12 - Graphical User Interface Concepts: Part.
Module 3: Working with Components. Overview An Introduction to Key.NET Framework Development Technologies Creating a Simple.NET Framework Component Creating.
1 Chapter Eleven Handling Events. 2 Objectives Learn about delegates How to create composed delegates How to handle events How to use the built-in EventHandler.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Module 1: Getting Started. Introduction to.NET and the.NET Framework Exploring Visual Studio.NET Creating a Windows Application Project Overview Use Visual.
1 Introduction to C# Programming Console applications No visual components Only text output Two types MS-DOS prompt - Used in Windows 95/98/ME Command.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
C# Programming: From Problem Analysis to Program Design1 10 Advanced Object-Oriented Programming Features C# Programming: From Problem Analysis to Program.
PRIOR TO WEB SERVICES THE OTHER TECHNOLOGIES ARE:.
1.
Object-Oriented Application Development Using VB.NET 1 Chapter 10 VB.NET GUI Components Overview.
Getting Started with.NET Getting Started with.NET/Lesson 1/Slide 1 of 31 Objectives In this lesson, you will learn to: *Identify the components of the.NET.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 3 – Introduction to C# Programming Outline 3.1 Introduction 3.2 Simple Program: Printing a Line.
Module 1 Introducing C# and the.NET Framework. Module Overview Introduction to the.NET Framework 4 Creating Projects Within Visual Studio 2010 Writing.
July 22, 2001Introduction to.NET1 Introduction to.NET Framework Gholamali Semsarzadeh July 2001.
Appendix A: Windows Forms. 2 Overview Describe the structure of a Windows Forms application –application entry point –forms –components and controls Introduce.
Text Introduction to.NET Framework. CONFIDENTIAL Agenda .NET Training – Purpose  What is.NET?  Why.NET?  Advantages  Architecture  Components: CLR,
Lecture Set 1 Part B: Understanding Visual Studio and.NET – Structure and Terminology 1/16/ :04 PM.
Microsoft Visual Basic 2015 CHAPTER ONE Introduction to Visual Basic 2015 Programming.
IS 350 Course Introduction. Slide 2 Objectives Identify the steps performed in the software development life cycle Describe selected tools used to design.
DotNetSpider Editor Hefin Dsouza
Advanced Object-Oriented Programming Features
Introduction to Visual Basic 2008 Programming
C# and the .NET Framework
Introduction to .NET Framework Ch2 – Deitel’s Book
Module 1: Getting Started
VISUAL BASIC.
CIS16 Application Development – Programming with Visual Basic
Creating a Windows Forms User Interface
Chapter 3 – Introduction to C# Programming
Presentation transcript:

Building.NET GUIs for Haskell applications Beatriz Alarcón Jiménez

.NET Technologies 2006 Outline Introduction Introduction Overview of.NET graphic controls Overview of.NET graphic controls A simple case study A simple case study Interoperability by means of COM in Haskell Interoperability by means of COM in Haskell Integration of COM into.NET Integration of COM into.NET A.NET version of Mu-term A.NET version of Mu-term Conclusions and future work Conclusions and future work

.NET Technologies 2006 Introduction.NET: a new framework for Software Development.NET: a new framework for Software Development Functional languages: Haskell Functional languages: Haskell Advantages: powerful features for developing software Advantages: powerful features for developing software Disadvantages: lack of an Integrated Development Environment (IDE) to build GUIs Disadvantages: lack of an Integrated Development Environment (IDE) to build GUIs COM (Component Object Model) COM (Component Object Model)

.NET Technologies 2006 Introduction From Haskell to.NET through COM From Haskell to.NET through COM Starting point: Haskell Direct Starting point: Haskell Direct A framework for Haskell FFI (Foreign Fuction Interface) based on the standard IDL (Interface Definition Language) COM component DLL COM Haskell component

.NET Technologies 2006 Overview of.NET graphic controls System.Windows.Forms namespace System.Windows.Forms namespace.NET controls and data.NET controls and data Button, GroupBox, Panel, Label, Splitter - CheckBox, RadioButton Bool ListBox([Int],[String]) ComboBox(Int,[String]) ListView[[String]] TrackBar, ProgressBar, NumericUpDown Int TextBox, Rich TextBox String MainMenu, OpenFileDialog, SaveFileDialog, FolderBrowserDialog _

.NET Technologies 2006 A simple case study Simple graphic interface to introduce and manipulate strings by means of simple transformations: Simple graphic interface to introduce and manipulate strings by means of simple transformations: Converting the characters of the string into capital or small letters Converting the characters of the string into capital or small letters Removing spare blank spaces Removing spare blank spaces Simple encryption (Caesar’s method) Simple encryption (Caesar’s method)

.NET Technologies 2006 A simple case study In the Haskell part (Hlist.hs): In the Haskell part (Hlist.hs): type Focus = Int type Length = Int data HL = H_L [(String, Length )] Focus deriving Show addPair :: HL -> String -> HL -- Adds a new string and its length getString :: HL -> String -- Obtains the `current' string writeString :: HL -> String -> HL -- Updates the `current' string getLength :: HL -> Int -- Length of the `current' string setFocus :: HL -> Int -> HL -- Sets the (index of) `current' string toUpperCase :: String -> String toLowerCase :: String -> String deleteB :: String -> String encrypt :: String -> String

.NET Technologies 2006 Interoperability by means of COM in Haskell A Haskell program that implements a COM component consists of four parts: A Haskell program that implements a COM component consists of four parts: The application code, written in Haskell by the programmer The application code, written in Haskell by the programmer An IDL specification describing the Haskell functions which we want to make accesible through the COM interface An IDL specification describing the Haskell functions which we want to make accesible through the COM interface A set of Haskell modules which are automatically generated from the IDL by the HDirect tool A set of Haskell modules which are automatically generated from the IDL by the HDirect tool A Haskell library module, Com, that exports all the functions needed to support COM objects in Haskell and a C library module that provides some Run-Time Support (RTS) A Haskell library module, Com, that exports all the functions needed to support COM objects in Haskell and a C library module that provides some Run-Time Support (RTS)

.NET Technologies 2006 A Haskell COM component Example.idl EXAMPLE.hs ExampleProxy.hs Com.lhs (library) HDirec t RTS Hlist.hs

.NET Technologies 2006 The IDL of the Haskell Component IDL is a declarative language to describe the interface of a component IDL is a declarative language to describe the interface of a component In the IDL specification we declare (the profiles of the Haskell) functions we wish to have accesible from C# code In the IDL specification we declare (the profiles of the Haskell) functions we wish to have accesible from C# code The interface for the function deleteB extracted from example.idl: The interface for the function deleteB extracted from example.idl: HRESULT deleteB();

.NET Technologies 2006 Encapsulating a Haskell component as a COM component Once the IDL has been specified, the next step is to generate the proxy (ExampleProxy.hs, automatically) and the skeleton of the component Once the IDL has been specified, the next step is to generate the proxy (ExampleProxy.hs, automatically) and the skeleton of the component Regarding the definition of the skeleton, HDirect accomplishes the following tasks: Regarding the definition of the skeleton, HDirect accomplishes the following tasks: To import the necessary Haskell modules To import the necessary Haskell modules To introduce a State type to implement the persistence of the funtional data by means of a mutable variable To introduce a State type to implement the persistence of the funtional data by means of a mutable variable To include Haskell declarations corresponding to the funtions defined in the IDL To include Haskell declarations corresponding to the funtions defined in the IDL

.NET Technologies 2006 Encapsulating a Haskell component as a COM component module EXAMPLE where (...) import IOExts import qualified Hlist --Pure Haskell Component data State = State(IORef HList.HL) deleteB :: State -> Prelude.IO () -> Prelude.IO () deleteB (State st) = do { hl <- readIORef st hl <- readIORef st ; str' <- Prelude.return (HList.deleteB (HList.getString hl)) ; str' <- Prelude.return (HList.deleteB (HList.getString hl)) ; writeIORef st (HList.writeString str' hl) ; writeIORef st (HList.writeString str' hl)}(…)

.NET Technologies 2006 Creating a COM DLL from Haskell modules After compiling these modules, it is necessary to provide a Main module. After compiling these modules, it is necessary to provide a Main module. Once the module Main has been compiled, we use HDirect to build the type library (.tlb) from the IDL and the proxy (example.tlb) Once the module Main has been compiled, we use HDirect to build the type library (.tlb) from the IDL and the proxy (example.tlb) We must bind the type library to our DLL We must bind the type library to our DLL Now, we can build the DLL including all compiled modules of the application Now, we can build the DLL including all compiled modules of the application

.NET Technologies 2006 Integration of COM into.NET Register the DLL (regsvr32.exe) Register the DLL (regsvr32.exe) The data types, error management,…are different for managed and unmanaged objects The data types, error management,…are different for managed and unmanaged objects Tlbimp is a console application that converts the type definitions in a COM type library into equivalent.NET assembly definitions Tlbimp is a console application that converts the type definitions in a COM type library into equivalent.NET assembly definitions Now, in VS.NET, we can add the generated assembly as reference in our Windows application Now, in VS.NET, we can add the generated assembly as reference in our Windows application

.NET Technologies 2006 Integration of COM into.NET In the C# component, we create an instance of the class In the C# component, we create an instance of the class ExampleClass h=new ExampleClass(); ExampleClass h=new ExampleClass(); Haskell functions can be accessed as if they were C# functions Haskell functions can be accessed as if they were C# functions

.NET Technologies 2006 private void update() {this.index=this.cbTextList.SelectedIndex; string str=h.getString(); this.tbEntryText.Text=str; this.tbLength.Text=h.getLength().ToString(); this.cbTextList.Items.RemoveAt(index);this.cbTextList.Items.Insert(index,str);this.cbTextList.Text=str;} private void bdeleteBln_Click(object sender, System.EventArgs e) { h.deleteB(); this.update();} Example.cs Example.cs

.NET Technologies 2006 A.NET version of Mu-term Mu-term is a termination proof tool for (Context-Sensitive) Rewriting Systems Mu-term is a termination proof tool for (Context-Sensitive) Rewriting Systems Mu-term is written in Haskell and wxHaskell was used to develop the graphical user interface Mu-term is written in Haskell and wxHaskell was used to develop the graphical user interface The system consists of around 30 Haskell modules containing more than 5000 lines of code The system consists of around 30 Haskell modules containing more than 5000 lines of code

.NET Technologies 2006 Main window of Mu-term Main window of Mu-term ButtonsTextBox MainMenu, OpenFileDialog, SaveFileDialog GroupBoxTrackBar ComboBoxCheckBox

.NET Technologies 2006 ListView TextBox ListBox Other windows of Mu-term Other windows of Mu-term

.NET Technologies 2006 A.NET version of Mu-term We have developed a new (hybrid) version of Mu-term, which has the same functionality but a new GUI written in C# We have developed a new (hybrid) version of Mu-term, which has the same functionality but a new GUI written in C# Mu-term is available at: Mu-term is available at:

.NET Technologies 2006 Conclusions We have shown how to integrate software components developed in Haskell together with (graphic) components developed in a.NET language such as C# We have shown how to integrate software components developed in Haskell together with (graphic) components developed in a.NET language such as C# We have demonstrated the practicality of this approach by giving a new.NET GUI to Mu-term We have demonstrated the practicality of this approach by giving a new.NET GUI to Mu-term

.NET Technologies 2006 Thanks for your attention!